From 89383695edb4b5b1783b33028de7e0cad88507cf Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 31 Aug 2023 22:51:07 +0300 Subject: [PATCH] Make watchdog timeouts more precise. --- telegram-bot-api/ClientManager.cpp | 2 +- telegram-bot-api/telegram-bot-api.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/telegram-bot-api/ClientManager.cpp b/telegram-bot-api/ClientManager.cpp index b94ab75..0cdfe05 100644 --- a/telegram-bot-api/ClientManager.cpp +++ b/telegram-bot-api/ClientManager.cpp @@ -531,7 +531,7 @@ void ClientManager::raw_event(const td::Event::Raw &event) { void ClientManager::timeout_expired() { send_closure(watchdog_id_, &Watchdog::kick); - set_timeout_in(WATCHDOG_TIMEOUT / 2); + set_timeout_in(WATCHDOG_TIMEOUT / 10); double now = td::Time::now(); if (now > next_tqueue_gc_time_) { diff --git a/telegram-bot-api/telegram-bot-api.cpp b/telegram-bot-api/telegram-bot-api.cpp index 19b87f8..08bafb8 100644 --- a/telegram-bot-api/telegram-bot-api.cpp +++ b/telegram-bot-api/telegram-bot-api.cpp @@ -562,7 +562,7 @@ int main(int argc, char *argv[]) { if (now >= start_time + 600) { auto guard = sched.get_main_guard(); send_closure(watchdog_id, &Watchdog::kick); - next_watchdog_kick_time = now + WATCHDOG_TIMEOUT / 2; + next_watchdog_kick_time = now + WATCHDOG_TIMEOUT / 10; } if (!need_dump_statistics.test_and_set() || now > last_dump_time + 300.0) {