Fix repeated request of channel difference.

This commit is contained in:
John Preston 2024-09-12 14:07:27 +04:00
parent a5f1209f28
commit d3bcf63cf7

View file

@ -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);