From ad3bd4cc0d5fbe5cc88d3534ad6ff1869c223cc5 Mon Sep 17 00:00:00 2001 From: Him188 Date: Tue, 8 Jun 2021 12:19:05 +0800 Subject: [PATCH] Stop BotOnlineWatchdog if bot is closed --- .../kotlin/network/handler/selector/SelectorNetworkHandler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirai-core/src/commonMain/kotlin/network/handler/selector/SelectorNetworkHandler.kt b/mirai-core/src/commonMain/kotlin/network/handler/selector/SelectorNetworkHandler.kt index 3a0bda149..39f4ad7f1 100644 --- a/mirai-core/src/commonMain/kotlin/network/handler/selector/SelectorNetworkHandler.kt +++ b/mirai-core/src/commonMain/kotlin/network/handler/selector/SelectorNetworkHandler.kt @@ -61,7 +61,7 @@ internal class SelectorNetworkHandler( if (allowActiveMaintenance) { val bot = context.bot scope.launch(scope.hierarchicalName("BotOnlineWatchdog ${bot.id}")) { - while (isActive) { + while (isActive && bot.isActive) { val instance = selector.getCurrentInstanceOrCreate() awaitState(State.CLOSED) // suspend until next CLOSED