Limit the number of ignored updates before end of the first get difference.
This commit is contained in:
parent
f098853eb5
commit
8a711b56d9
@ -257,8 +257,8 @@ UpdatesManager::UpdatesManager(Td *td, ActorShared<> parent) : td_(td), parent_(
|
|||||||
pending_audio_transcription_timeout_.set_callback(on_pending_audio_transcription_timeout_callback);
|
pending_audio_transcription_timeout_.set_callback(on_pending_audio_transcription_timeout_callback);
|
||||||
pending_audio_transcription_timeout_.set_callback_data(static_cast<void *>(td_));
|
pending_audio_transcription_timeout_.set_callback_data(static_cast<void *>(td_));
|
||||||
|
|
||||||
if (td_->option_manager_->get_option_integer("since_last_open") < 3600 && !td_->auth_manager_->is_bot()) {
|
if (!td_->auth_manager_->is_authorized() || !td_->auth_manager_->is_bot()) {
|
||||||
finished_first_get_difference_ = true;
|
skipped_postponed_updates_after_start_ = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2106,7 +2106,7 @@ void UpdatesManager::after_get_difference() {
|
|||||||
retry_timeout_.cancel_timeout();
|
retry_timeout_.cancel_timeout();
|
||||||
retry_time_ = 1;
|
retry_time_ = 1;
|
||||||
|
|
||||||
finished_first_get_difference_ = true;
|
skipped_postponed_updates_after_start_ = 0;
|
||||||
td_->option_manager_->set_option_empty("since_last_open");
|
td_->option_manager_->set_option_empty("since_last_open");
|
||||||
|
|
||||||
// cancels qts_gap_timeout_ if needed, can apply some updates received during getDifference,
|
// cancels qts_gap_timeout_ if needed, can apply some updates received during getDifference,
|
||||||
|
@ -263,7 +263,7 @@ class UpdatesManager final : public Actor {
|
|||||||
bool are_sessions_inited_ = false;
|
bool are_sessions_inited_ = false;
|
||||||
|
|
||||||
bool running_get_difference_ = false;
|
bool running_get_difference_ = false;
|
||||||
bool finished_first_get_difference_ = false;
|
int32 skipped_postponed_updates_after_start_ = 50000;
|
||||||
int32 last_confirmed_pts_ = 0;
|
int32 last_confirmed_pts_ = 0;
|
||||||
int32 last_confirmed_qts_ = 0;
|
int32 last_confirmed_qts_ = 0;
|
||||||
int32 min_postponed_update_pts_ = 0;
|
int32 min_postponed_update_pts_ = 0;
|
||||||
@ -310,8 +310,12 @@ class UpdatesManager final : public Actor {
|
|||||||
void on_qts_ack(PtsManager::PtsId ack_token);
|
void on_qts_ack(PtsManager::PtsId ack_token);
|
||||||
void save_qts(int32 qts);
|
void save_qts(int32 qts);
|
||||||
|
|
||||||
bool can_postpone_updates() const {
|
bool can_postpone_updates() {
|
||||||
return finished_first_get_difference_;
|
if (skipped_postponed_updates_after_start_ == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
skipped_postponed_updates_after_start_--;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_date(int32 date, bool from_update, string date_source);
|
void set_date(int32 date, bool from_update, string date_source);
|
||||||
|
Loading…
Reference in New Issue
Block a user