Skip to content

Commit

Permalink
perf: 优化规则执行逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jan 3, 2024
1 parent f83e32b commit dc66369
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/src/main/kotlin/li/songe/gkd/service/GkdAbService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,6 @@ class GkdAbService : CompositionAbService({
val actionResult = rule.performAction(context, target)
if (actionResult.result) {
rule.trigger()
if (rule.hasNext) {
scope.launch(queryThread) {
delay(500L)
if (queryTaskJob?.isActive != true) {
newQueryTask()
}
}
}
toastClickTip()
insertClickLog(rule)
LogUtils.d(
Expand All @@ -184,6 +176,15 @@ class GkdAbService : CompositionAbService({
}
}
}
val t = System.currentTimeMillis()
if (t - lastTriggerTime < 10_000 || t - appChangeTime < 5_000) {
scope.launch(queryThread) {
delay(300)
if (queryTaskJob?.isActive != true) {
newQueryTask()
}
}
}
}
}

Expand Down

0 comments on commit dc66369

Please sign in to comment.