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) } }