From c9375114124b339e8072cec1a083f990300d6697 Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 19 Feb 2020 12:16:28 +0800 Subject: [PATCH] Fix login retry --- mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt index c988b0a79..e1d603d87 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt @@ -94,8 +94,10 @@ abstract class BotImpl constructor( } bot.logger.info("Connection dropped or lost by server, retrying login") - tryNTimesOrException(configuration.reconnectionRetryTimes) { - delay(configuration.reconnectPeriodMillis) + tryNTimesOrException(configuration.reconnectionRetryTimes) { tryCount -> + if (tryCount != 0) { + delay(configuration.reconnectPeriodMillis) + } network.relogin() logger.info("Reconnected successfully") return@subscribeAlways