From 3391c643f3c90d0d6f56e2885e062d294f9d5640 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 26 Jan 2024 14:01:44 +0300 Subject: [PATCH] Don't try to fetch the same update more than once. --- td/telegram/UpdatesManager.cpp | 6 ++++++ td/telegram/UpdatesManager.h | 1 + 2 files changed, 7 insertions(+) diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 070a88cab..6f4e04a65 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -337,6 +337,12 @@ void UpdatesManager::repair_pts_gap() { if (it->second.pts != pts + it->second.pts_count) { return; } + if (last_fetched_pts_ == pts) { + VLOG(get_difference) << "Don't fetch again update with PTS = " << pts; + return; + } + last_fetched_pts_ = pts; + VLOG(get_difference) << "Fetch update with PTS = " << pts; pts_short_gap_++; auto promise = diff --git a/td/telegram/UpdatesManager.h b/td/telegram/UpdatesManager.h index fc6349c67..aa8f3dd95 100644 --- a/td/telegram/UpdatesManager.h +++ b/td/telegram/UpdatesManager.h @@ -215,6 +215,7 @@ class UpdatesManager final : public Actor { int32 pts_fixed_short_gap_ = 0; int32 pts_gap_ = 0; int32 pts_diff_ = 0; + int32 last_fetched_pts_ = 0; int32 qts_gap_ = 0; int32 qts_diff_ = 0;