From f169ae654cecc2944b085f813ca567935e889c5b Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 1 Nov 2023 23:01:08 +0300 Subject: [PATCH] Slowly recheck webhook IP addresses after loading them from database. --- telegram-bot-api/WebhookActor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/telegram-bot-api/WebhookActor.cpp b/telegram-bot-api/WebhookActor.cpp index e2870b6..7e04a67 100644 --- a/telegram-bot-api/WebhookActor.cpp +++ b/telegram-bot-api/WebhookActor.cpp @@ -691,7 +691,12 @@ void WebhookActor::handle(td::unique_ptr response) { void WebhookActor::start_up() { max_loaded_updates_ = max_connections_ * 2; - next_ip_address_resolve_time_ = last_success_time_ = td::Time::now() - 3600; + last_success_time_ = td::Time::now() - 2 * IP_ADDRESS_CACHE_TIME; + if (from_db_flag_) { + next_ip_address_resolve_time_ = td::Time::now() + td::Random::fast(0, IP_ADDRESS_CACHE_TIME); + } else { + next_ip_address_resolve_time_ = last_success_time_; + } active_new_connection_flood_.add_limit(0.5, 10);