fix(ActionScheduler): use withTimeoutOrNull when waiting for ACTIVE state, to avoid exception leading to wheel stopped

This commit is contained in:
2026-02-08 21:56:35 +08:00
parent 84b96b6645
commit 7cb565fd1b

View File

@@ -137,7 +137,7 @@ class ActionScheduler : AgentRunningSubModule<Set<ScheduledActionData>, Void>()
val seconds = java.time.Duration.between( val seconds = java.time.Duration.between(
actionsLoadingTime, actionsLoadingTime.truncatedTo(ChronoUnit.HOURS).plusHours(1) actionsLoadingTime, actionsLoadingTime.truncatedTo(ChronoUnit.HOURS).plusHours(1)
).toMillis() ).toMillis()
withTimeout(seconds) { withTimeoutOrNull(seconds) {
state.first { it == WheelState.ACTIVE } state.first { it == WheelState.ACTIVE }
} }
state.value = WheelState.SLEEPING state.value = WheelState.SLEEPING