From e2bd9eb0af75c319091863694164f0a6393524f8 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 21:19:40 +0800 Subject: [PATCH] fix(ActionScheduler): enqueue same-hour actions in wheel and add scheduling debug logs --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 102ee506..bc3f584b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -74,6 +74,7 @@ class ActionScheduler : AgentRunningSubModule, 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, 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) } }