From d8c8291886c7ac292199b569bb79327f05a37e23 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 14 Feb 2024 16:59:22 +0300 Subject: [PATCH] Allow faster reopen for bots that were successfully authorized. --- telegram-bot-api/Client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index e0ace90..413a3c1 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -6353,9 +6353,9 @@ void Client::finish_closing() { auto timeout = [&] { if (next_authorization_time_ <= 0.0) { - return 600.0; + return was_authorized_ && authorization_date_ < get_unix_time() - 1800 ? 1.0 : 1800.0; } - return td::min(next_authorization_time_ - td::Time::now(), 600.0); + return td::min(next_authorization_time_ - td::Time::now(), 1800.0); }(); set_timeout_in(timeout); LOG(INFO) << "Keep client opened for " << timeout << " seconds";