From 00a6271edbccb571ef42efd7a2b0ae3d889c70b8 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 11 Jul 2023 15:50:50 +0300 Subject: [PATCH] Restore PTS after overflow. --- td/telegram/UpdatesManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 4d0eec68f..c626599e1 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -2733,8 +2733,11 @@ void UpdatesManager::add_pending_pts_update(tl_object_ptr if (new_pts < old_pts - 99 && source != AFTER_GET_DIFFERENCE_SOURCE) { bool need_restore_pts = new_pts < old_pts - 19999; auto now = Time::now(); - if (now > last_pts_jump_warning_time_ + 1 && (need_restore_pts || now < last_pts_jump_warning_time_ + 5) && - !(old_pts == std::numeric_limits::max() && running_get_difference_)) { + if (old_pts == 2100000000 && new_pts < 1100000000 && pts_count <= 10000) { + set_pts(1, "restore PTS"); + old_pts = get_pts(); + } else if (now > last_pts_jump_warning_time_ + 1 && (need_restore_pts || now < last_pts_jump_warning_time_ + 5) && + !(old_pts == std::numeric_limits::max() && running_get_difference_)) { LOG(ERROR) << "Restore PTS after delete_first_messages from " << old_pts << " to " << new_pts << " is disabled, pts_count = " << pts_count << ", update is from " << source << ": " << oneline(to_string(update));