mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
fix(ActionScheduler): use withTimeoutOrNull when waiting for ACTIVE state, to avoid exception leading to wheel stopped
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user