mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-13 06:30:13 +08:00
Revert "Avoid using kotlin.time.Duration API in a binary-sensitive way, fix #1066"
...since 2.5 targets Kotlin 1.4.30
This reverts commit cedb239f
This commit is contained in:
parent
a8f3bc876d
commit
2b6eddd0d7
@ -272,7 +272,7 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
|
||||
bot.client.wLoginSigInfo.sKey.run {
|
||||
val delay = (expireTime - creationTime).seconds - 5.minutes
|
||||
logger.info { "Scheduled key refresh in ${delay.toHumanReadableString()}." }
|
||||
delay(delay.toLongMilliseconds()) // avoid delay(Duration) to keep binary compatibility
|
||||
delay(delay)
|
||||
}
|
||||
runCatching {
|
||||
refreshKeys()
|
||||
|
@ -33,7 +33,7 @@ internal class ScheduledJob(
|
||||
private val channel = Channel<Unit>(Channel.CONFLATED)
|
||||
|
||||
fun notice() {
|
||||
if (interval.toLongMilliseconds() != 0L) { // Avoid Duration.ZERO for binary compatibility
|
||||
if (interval == Duration.ZERO) {
|
||||
launch { task() }
|
||||
} else channel.offer(Unit)
|
||||
}
|
||||
@ -47,7 +47,7 @@ internal class ScheduledJob(
|
||||
}
|
||||
|
||||
init {
|
||||
if (interval.toLongMilliseconds() != 0L) { // Avoid Duration.ZERO for binary compatibility
|
||||
if (interval != Duration.ZERO) {
|
||||
launch {
|
||||
channel.receiveAsFlow()
|
||||
.runCatching {
|
||||
|
Loading…
Reference in New Issue
Block a user