From 87c34cc699129e42394d448a68af84a4135b326f Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 20 Feb 2026 17:29:26 +0800 Subject: [PATCH] refactor(modules): convert `ActionScheduler` to `Standalone` and simplify async `execute` signature --- .../dispatcher/scheduler/ActionScheduler.kt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Partner-Core/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Core/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 39a93a03..650ab5e5 100644 --- a/Partner-Core/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Core/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -29,7 +29,7 @@ import java.time.temporal.ChronoUnit import java.util.stream.Collectors import kotlin.jvm.optionals.getOrNull -class ActionScheduler : AbstractAgentModule.Sub, Void?>() { +class ActionScheduler : AbstractAgentModule.Standalone() { @InjectCapability private lateinit var actionCapability: ActionCapability @@ -79,17 +79,14 @@ class ActionScheduler : AbstractAgentModule.Sub, Void?>() { }) } - override fun execute(input: Set): Void? { - schedulerScope.launch { - for (schedulableData in input) { - log.debug("New data to schedule: {}", schedulableData) - timeWheel.schedule(schedulableData) - if (schedulableData is SchedulableExecutableAction) { - actionCapability.putAction(schedulableData) - } + fun execute(input: Set) = schedulerScope.launch { + for (schedulableData in input) { + log.debug("New data to schedule: {}", schedulableData) + timeWheel.schedule(schedulableData) + if (schedulableData is SchedulableExecutableAction) { + actionCapability.putAction(schedulableData) } } - return null } private class TimeWheel(