diff --git a/backend/mirai-console/src/util/CoroutineScopeUtils.kt b/backend/mirai-console/src/util/CoroutineScopeUtils.kt index 8d12eeae4..490bbfe73 100644 --- a/backend/mirai-console/src/util/CoroutineScopeUtils.kt +++ b/backend/mirai-console/src/util/CoroutineScopeUtils.kt @@ -68,16 +68,13 @@ internal class TimedTask( // `delay` always checks for cancellation lastChangedTime.loop { last -> val current = currentTimeMillis() - if (last == UNCHANGED) { - runIgnoreException { - delay(3.seconds) // accuracy not necessary - } ?: return@launch - return@loop - } if (current - last > intervalMillis) { if (!lastChangedTime.compareAndSet(last, UNCHANGED)) return@loop action() } + runIgnoreException { + delay(3.seconds) // accuracy not necessary + } ?: return@launch } } }