From ec8e44de5a6b82f364cc508053965f48cf700171 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 24 Jul 2023 21:41:15 +0300 Subject: [PATCH] Improve warnings for old updates. --- telegram-bot-api/Client.cpp | 4 +++- telegram-bot-api/Client.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 34623be..7597b5e 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -5015,6 +5015,7 @@ void Client::on_update_authorization_state() { td::reset_to_empty(pending_updates_); } last_update_creation_time_ = td::Time::now(); + log_in_date_ = get_unix_time(); } return loop(); } @@ -11488,7 +11489,8 @@ void Client::process_new_message_queue(int64 chat_id, int state) { auto now = get_unix_time(); auto update_delay_time = now - td::max(message_date, parameters_->shared_data_->get_unix_time(webhook_set_time_)); const auto UPDATE_DELAY_WARNING_TIME = 10 * 60; - if (update_delay_time > UPDATE_DELAY_WARNING_TIME && message_date > last_synchronization_error_date_ + 60) { + if (message_date > log_in_date_ && update_delay_time > UPDATE_DELAY_WARNING_TIME && + message_date > last_synchronization_error_date_ + 60) { if (delayed_update_count_ == 0) { delayed_update_type_ = update_type; delayed_chat_id_ = chat_id; diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index 467f6cb..fa93505 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -1153,6 +1153,8 @@ class Client final : public WebhookActor::Callback { double previous_get_updates_finish_time_ = 0; double next_get_updates_conflict_time_ = 0; + int32 log_in_date_ = 0; + int32 flood_limited_query_count_ = 0; double next_flood_limit_warning_time_ = 0;