From 4a11375f3614be8affdb418fcabf31ceb3e94b45 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 1 Jun 2026 02:38:06 +0200 Subject: [PATCH] fix(tgbot): send login notification asynchronously UserLoginNotify ran SendMsgToTgbotAdmins synchronously on the login request goroutine. When Telegram was unreachable, the send retried up to 3x with a 30s timeout each, blocking the login handler for ~90s+ and effectively locking users out (issue #4585). Dispatch the send in a goroutine after the cheap bot-running/login-notify-enabled guards so login always returns promptly; the existing per-send 30s context timeout and bounded retries keep the background goroutine from leaking. --- web/service/tgbot.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/service/tgbot.go b/web/service/tgbot.go index 2cf6c638..b59e7d7c 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -2665,7 +2665,7 @@ func (t *Tgbot) UserLoginNotify(attempt LoginAttempt) { msg += t.I18nBot("tgbot.messages.username", "Username=="+attempt.Username) msg += t.I18nBot("tgbot.messages.ip", "IP=="+attempt.IP) msg += t.I18nBot("tgbot.messages.time", "Time=="+attempt.Time) - t.SendMsgToTgbotAdmins(msg) + go t.SendMsgToTgbotAdmins(msg) } // getInboundUsages retrieves and formats inbound usage information.