fix(ActionScheduler): enqueue same-hour actions in wheel and add scheduling debug logs

This commit is contained in:
2026-02-09 21:19:40 +08:00
parent 9ec03c4c95
commit e2bd9eb0af

View File

@@ -74,6 +74,7 @@ class ActionScheduler : AgentRunningSubModule<Set<ScheduledActionData>, Void>()
schedulerScope.launch {
scheduledActionDataSet?.run {
for (scheduledActionData in scheduledActionDataSet) {
log.debug("New action to schedule: {}", scheduledActionData)
actionCapability.putAction(scheduledActionData)
timeWheel.schedule(scheduledActionData)
}
@@ -121,11 +122,17 @@ class ActionScheduler : AgentRunningSubModule<Set<ScheduledActionData>, Void>()
logFailedStatus(actionData)
return@checkThenExecute
}
log.debug("Action next execution time: {}", parseToZonedDateTime)
val hour = parseToZonedDateTime.hour
actionsGroupByHour[hour].add(actionData)
log.debug("Action scheduled at {}", hour)
if (it.hour == hour) {
val wheelOffset = parseToZonedDateTime.minute * 60 + parseToZonedDateTime.second
wheel[wheelOffset].add(actionData)
state.value = WheelState.ACTIVE
log.debug("Action scheduled at wheel offset {}", wheelOffset)
}
}