Fix applying of postponed updates.

GitOrigin-RevId: 924efd81a5dfd4235f55a0ddfdf1c94b76fd8dd2
This commit is contained in:
levlam 2020-02-08 23:31:27 +03:00
parent 660acfef22
commit 945a3a1dc3

View File

@ -1097,11 +1097,6 @@ void UpdatesManager::after_get_difference() {
if (postponed_updates_.size()) {
VLOG(get_difference) << "Begin to apply " << postponed_updates_.size() << " postponed updates";
while (!postponed_updates_.empty()) {
if (running_get_difference_) {
VLOG(get_difference) << "Finish to apply postponed updates with " << postponed_updates_.size()
<< " updates left, because forced to run getDifference";
return;
}
auto it = postponed_updates_.begin();
auto updates = std::move(it->second.updates);
auto updates_seq_begin = it->second.seq_begin;
@ -1109,6 +1104,11 @@ void UpdatesManager::after_get_difference() {
// ignore it->second.date, because it may be too old
postponed_updates_.erase(it);
on_pending_updates(std::move(updates), updates_seq_begin, updates_seq_end, 0, "postponed updates");
if (running_get_difference_) {
VLOG(get_difference) << "Finish to apply postponed updates with " << postponed_updates_.size()
<< " updates left, because forced to run getDifference";
return;
}
}
VLOG(get_difference) << "Finish to apply postponed updates";
}