From d3bcf63cf79ba3e7851b1759c738f265773095bd Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 12 Sep 2024 14:07:27 +0400 Subject: [PATCH] Fix repeated request of channel difference. --- Telegram/SourceFiles/api/api_updates.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index 25ee380f84..ae99d29541 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -655,6 +655,7 @@ void Updates::getDifferenceAfterFail() { wait = wait ? std::min(wait, i->second - now) : (i->second - now); ++i; } else { + i->first->ptsSetRequesting(false); getChannelDifference(i->first, ChannelDifferenceRequest::AfterFail); i = _whenGetDiffAfterFail.erase(i); } @@ -703,7 +704,9 @@ void Updates::getChannelDifference( _whenGetDiffByPts.remove(channel); } - if (!channel->ptsInited() || channel->ptsRequesting()) return; + if (!channel->ptsInited() || channel->ptsRequesting()) { + return; + } if (from != ChannelDifferenceRequest::AfterFail) { _whenGetDiffAfterFail.remove(channel); @@ -1554,6 +1557,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { } if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping new channel message because getting the difference.")); return; } channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update); @@ -1646,6 +1650,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping channel message edit because getting the difference.")); return; } else { channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update); @@ -1661,6 +1666,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping pinned channel messages because getting the difference.")); return; } else { channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update); @@ -1775,6 +1781,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping delete channel messages because getting the difference.")); return; } channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update); @@ -1838,6 +1845,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { auto channel = session().data().channelLoaded(d.vchannel_id()); if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping channel web page update because getting the difference.")); return; } else { channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update);