Move retry_get_difference_timeout out of Dialog to allow retries for unknown dialogs.
This commit is contained in:
parent
d5a19f0a82
commit
be53ea2e1c
@ -35614,11 +35614,15 @@ void MessagesManager::on_get_channel_difference(
|
||||
|
||||
if (difference_ptr == nullptr) {
|
||||
bool have_access = have_input_peer(dialog_id, AccessRights::Read);
|
||||
if (have_access && d != nullptr) {
|
||||
channel_get_difference_retry_timeout_.add_timeout_in(dialog_id.get(), d->retry_get_difference_timeout);
|
||||
d->retry_get_difference_timeout *= 2;
|
||||
if (d->retry_get_difference_timeout > 60) {
|
||||
d->retry_get_difference_timeout = Random::fast(60, 80);
|
||||
if (have_access) {
|
||||
auto &delay = channel_get_difference_retry_timeouts_[dialog_id];
|
||||
if (delay == 0) {
|
||||
delay = 1;
|
||||
}
|
||||
channel_get_difference_retry_timeout_.add_timeout_in(dialog_id.get(), delay);
|
||||
delay *= 2;
|
||||
if (delay > 60) {
|
||||
delay = Random::fast(60, 80);
|
||||
}
|
||||
} else {
|
||||
after_get_channel_difference(dialog_id, false);
|
||||
@ -35626,6 +35630,8 @@ void MessagesManager::on_get_channel_difference(
|
||||
return;
|
||||
}
|
||||
|
||||
channel_get_difference_retry_timeouts_.erase(dialog_id);
|
||||
|
||||
LOG(INFO) << "Receive result of getChannelDifference for " << dialog_id << " with pts = " << request_pts
|
||||
<< " and limit = " << request_limit << ": " << to_string(difference_ptr);
|
||||
|
||||
@ -35671,8 +35677,6 @@ void MessagesManager::on_get_channel_difference(
|
||||
LOG_IF(ERROR, cur_pts != request_pts) << "Channel pts has changed from " << request_pts << " to " << d->pts << " in "
|
||||
<< dialog_id << " during getChannelDifference";
|
||||
|
||||
d->retry_get_difference_timeout = 1;
|
||||
|
||||
bool is_final = true;
|
||||
int32 timeout = 0;
|
||||
switch (difference_ptr->get_id()) {
|
||||
|
@ -1240,7 +1240,6 @@ class MessagesManager final : public Actor {
|
||||
|
||||
int32 pts = 0; // for channels only
|
||||
std::multimap<int32, PendingPtsUpdate> postponed_channel_updates; // for channels only
|
||||
int32 retry_get_difference_timeout = 1; // for channels only
|
||||
int32 pending_read_channel_inbox_pts = 0; // for channels only
|
||||
MessageId pending_read_channel_inbox_max_message_id; // for channels only
|
||||
int32 pending_read_channel_inbox_server_unread_count = 0; // for channels only
|
||||
@ -3237,6 +3236,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
std::unordered_map<DialogId, string, DialogIdHash> active_get_channel_differencies_;
|
||||
std::unordered_map<DialogId, uint64, DialogIdHash> get_channel_difference_to_log_event_id_;
|
||||
std::unordered_map<DialogId, int32, DialogIdHash> channel_get_difference_retry_timeouts_;
|
||||
|
||||
MultiTimeout channel_get_difference_timeout_{"ChannelGetDifferenceTimeout"};
|
||||
MultiTimeout channel_get_difference_retry_timeout_{"ChannelGetDifferenceRetryTimeout"};
|
||||
|
Loading…
Reference in New Issue
Block a user