@karlatemp 似乎没有push?
ArcticLampyrid 发布的最新帖子
-
询问:key refresh job是否应该在relogin时cancel
粗略阅读了下Mirai的代码
在closeEverythingAndRelogin
中launch
的key refresh job
似乎并不会被cancel
在重连时相关Content
似乎也不会被close
&renew
这是特意为之还是bug?
heartbeat job
等似乎是手动cancel
的:
QQAndroidBotNetworkHandler.kt#L121-L125override suspend fun closeEverythingAndRelogin(host: String, port: Int, cause: Throwable?, step: Int) { heartbeatJob?.cancel(CancellationException("relogin", cause)) heartbeatJob?.join() _packetReceiverJob?.cancel(CancellationException("relogin", cause)) _packetReceiverJob?.join()
key refresh job
创建后没有保留对Job
的引用
QQAndroidBotNetworkHandler.kt#L270-L283launch { while (isActive) { bot.client.wLoginSigInfo.sKey.run { val delay = (expireTime - creationTime).seconds - 5.minutes logger.info { "Scheduled key refresh in ${delay.toHumanReadableString()}." } delay(delay) } runCatching { refreshKeys() }.onFailure { logger.error("Failed to refresh key.", it) } } }