mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
refactor(ActionScheduler): remove useless delay in TimeWheel#wheel
This commit is contained in:
@@ -159,10 +159,6 @@ class ActionScheduler : AgentRunningSubModule<Set<ScheduledActionData>, Void>()
|
|||||||
// tick 推进(nano -> second)
|
// tick 推进(nano -> second)
|
||||||
val current = System.nanoTime()
|
val current = System.nanoTime()
|
||||||
val step = ((current - lastTickAdvanceTime) / 1_000_000_000L).toInt()
|
val step = ((current - lastTickAdvanceTime) / 1_000_000_000L).toInt()
|
||||||
if (step <= 0) {
|
|
||||||
delay(50) // 避免空转
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
val previousTick = tick
|
val previousTick = tick
|
||||||
tick = (tick + step).coerceAtMost(wheel.lastIndex)
|
tick = (tick + step).coerceAtMost(wheel.lastIndex)
|
||||||
|
|||||||
Reference in New Issue
Block a user