Replace usages of unstable API

This commit is contained in:
Him188 2021-04-25 19:26:20 +08:00
parent b25ea78c6f
commit 94f54b7c6d
2 changed files with 7 additions and 9 deletions

View File

@ -16,7 +16,6 @@ import net.mamoe.mirai.console.internal.util.runIgnoreException
import net.mamoe.mirai.utils.currentTimeMillis
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.time.seconds
@ConsoleExperimentalApi
public object CoroutineScopeUtils {
@ -70,7 +69,7 @@ internal class TimedTask(
val current = currentTimeMillis()
if (last == UNCHANGED) {
runIgnoreException<CancellationException> {
delay(3.seconds) // accuracy not necessary
delay(3000) // accuracy not necessary
} ?: return@launch
} else {
if (current - last > intervalMillis) {
@ -78,7 +77,7 @@ internal class TimedTask(
action()
}
runIgnoreException<CancellationException> {
delay(3.seconds) // accuracy not necessary
delay(3000) // accuracy not necessary
} ?: return@launch
}
}

View File

@ -1,10 +1,10 @@
/*
* Copyright 2019-2020 Mamoe Technologies and contributors.
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@file:Suppress(
@ -36,7 +36,6 @@ import java.io.FileDescriptor
import java.io.FileOutputStream
import java.io.PrintStream
import kotlin.system.exitProcess
import kotlin.time.minutes
/**
* mirai-console-terminal CLI 入口点
@ -159,7 +158,7 @@ object MiraiConsoleTerminalLoader {
internal object ConsoleDataHolder : AutoSavePluginDataHolder,
CoroutineScope by MiraiConsole.childScope("ConsoleDataHolder") {
@ConsoleExperimentalApi
override val autoSaveIntervalMillis: LongRange = 1.minutes.toLongMilliseconds()..10.minutes.toLongMilliseconds()
override val autoSaveIntervalMillis: LongRange = 60_000L..10.times(60_000)
@ConsoleExperimentalApi
override val dataHolderName: String