Add source to schedule_get_channel_difference.
This commit is contained in:
parent
4898f42121
commit
8d7ba4da1b
@ -7462,7 +7462,7 @@ void MessagesManager::on_read_channel_inbox(ChannelId channel_id, MessageId max_
|
||||
// update from the future, keep it until it can be applied
|
||||
if (pts >= d->pending_read_channel_inbox_pts) {
|
||||
if (d->pending_read_channel_inbox_pts == 0) {
|
||||
schedule_get_channel_difference(dialog_id, pts, MessageId(), 0.001);
|
||||
schedule_get_channel_difference(dialog_id, pts, MessageId(), 0.001, "on_read_channel_inbox");
|
||||
}
|
||||
d->pending_read_channel_inbox_pts = pts;
|
||||
d->pending_read_channel_inbox_max_message_id = max_message_id;
|
||||
@ -9652,7 +9652,7 @@ void MessagesManager::after_get_difference() {
|
||||
}),
|
||||
"get missing");
|
||||
} else if (dialog_id.get_type() == DialogType::Channel) {
|
||||
schedule_get_channel_difference(dialog_id, 0, message_id, 0.001);
|
||||
schedule_get_channel_difference(dialog_id, 0, message_id, 0.001, "after_get_difference");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -12559,7 +12559,7 @@ void MessagesManager::read_history_inbox(Dialog *d, MessageId max_message_id, in
|
||||
}
|
||||
|
||||
if (max_message_id > d->last_new_message_id && dialog_id.get_type() == DialogType::Channel) {
|
||||
schedule_get_channel_difference(dialog_id, 0, max_message_id, 0.001);
|
||||
schedule_get_channel_difference(dialog_id, 0, max_message_id, 0.001, "read_history_inbox");
|
||||
}
|
||||
|
||||
int32 server_unread_count = calc_new_unread_count(d, max_message_id, MessageType::Server, unread_count);
|
||||
@ -14514,7 +14514,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
||||
// it is safer to completely ignore the message and re-get it through getChannelDifference
|
||||
Dialog *d = get_dialog(dialog_id);
|
||||
if (d != nullptr) {
|
||||
schedule_get_channel_difference(dialog_id, 0, message_id, 0.001);
|
||||
schedule_get_channel_difference(dialog_id, 0, message_id, 0.001, "create_message");
|
||||
return {DialogId(), nullptr};
|
||||
}
|
||||
}
|
||||
@ -14800,7 +14800,7 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, const
|
||||
LOG(INFO) << "Ignore " << old_message_id << "/" << message_id << " received not through update from " << source
|
||||
<< ": " << oneline(to_string(get_message_object(dialog_id, new_message.get(), "on_get_message")));
|
||||
if (dialog_id.get_type() == DialogType::Channel && have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
schedule_get_channel_difference(dialog_id, 0, message_id, 0.001);
|
||||
schedule_get_channel_difference(dialog_id, 0, message_id, 0.001, "on_get_message");
|
||||
}
|
||||
return FullMessageId();
|
||||
}
|
||||
@ -34683,7 +34683,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
||||
<< to_string(get_message_object(dialog_id, message.get(), "add_message_to_dialog"));
|
||||
|
||||
if (need_channel_difference_to_add_message(dialog_id, nullptr)) {
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), 0.001);
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), 0.001, "add_message_to_dialog");
|
||||
}
|
||||
} else {
|
||||
LOG(INFO) << "Ignore " << message_id << " in " << dialog_id << " received not through update from " << source;
|
||||
@ -37051,7 +37051,7 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
||||
d->pending_read_channel_inbox_pts = 0;
|
||||
on_dialog_updated(dialog_id, "fix_new_dialog 14");
|
||||
} else {
|
||||
schedule_get_channel_difference(dialog_id, d->pending_read_channel_inbox_pts, MessageId(), 0.001);
|
||||
schedule_get_channel_difference(dialog_id, d->pending_read_channel_inbox_pts, MessageId(), 0.001, source);
|
||||
}
|
||||
} else {
|
||||
d->pending_read_channel_inbox_pts = 0;
|
||||
@ -37404,7 +37404,7 @@ bool MessagesManager::set_dialog_order(Dialog *d, int64 new_order, bool need_sen
|
||||
auto dialog_type = dialog_id.get_type();
|
||||
if (dialog_type == DialogType::Channel && is_added && being_added_dialog_id_ != dialog_id) {
|
||||
repair_channel_server_unread_count(d);
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), 0.001);
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), 0.001, source);
|
||||
}
|
||||
if (dialog_type == DialogType::Channel && is_removed) {
|
||||
remove_all_dialog_notifications(d, false, source);
|
||||
@ -38179,8 +38179,9 @@ void MessagesManager::update_expected_channel_max_message_id(DialogId dialog_id,
|
||||
}
|
||||
|
||||
void MessagesManager::schedule_get_channel_difference(DialogId dialog_id, int32 expected_pts,
|
||||
MessageId expected_max_message_id, double delay) {
|
||||
LOG(INFO) << "Schedule getDifference in " << dialog_id;
|
||||
MessageId expected_max_message_id, double delay,
|
||||
const char *source) {
|
||||
LOG(INFO) << "Schedule getDifference in " << dialog_id << " from " << source;
|
||||
update_expected_channel_pts(dialog_id, expected_pts);
|
||||
update_expected_channel_max_message_id(dialog_id, expected_max_message_id);
|
||||
channel_get_difference_retry_timeout_.add_timeout_in(dialog_id.get(), delay);
|
||||
@ -38598,7 +38599,8 @@ void MessagesManager::on_get_channel_difference(
|
||||
if (delay == 0) {
|
||||
delay = 1;
|
||||
}
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), Random::fast(delay * 1000, delay * 1500) * 1e-3);
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), Random::fast(delay * 1000, delay * 1500) * 1e-3,
|
||||
"on_get_channel_difference");
|
||||
delay *= 2;
|
||||
if (delay > 60) {
|
||||
delay = Random::fast(60, 80);
|
||||
@ -38922,7 +38924,7 @@ void MessagesManager::after_get_channel_difference(DialogId dialog_id, bool succ
|
||||
auto expected_channel_pts_it = expected_channel_pts_.find(dialog_id);
|
||||
if (expected_channel_pts_it != expected_channel_pts_.end()) {
|
||||
if (success && expected_channel_pts_it->second > pts) {
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), 1.0);
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), 1.0, "after_get_channel_difference");
|
||||
}
|
||||
expected_channel_pts_.erase(expected_channel_pts_it);
|
||||
}
|
||||
@ -38930,7 +38932,7 @@ void MessagesManager::after_get_channel_difference(DialogId dialog_id, bool succ
|
||||
auto expected_channel_max_message_id_it = expected_channel_max_message_id_.find(dialog_id);
|
||||
if (expected_channel_max_message_id_it != expected_channel_max_message_id_.end()) {
|
||||
if (success && d != nullptr && expected_channel_max_message_id_it->second > d->last_new_message_id) {
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), 1.0);
|
||||
schedule_get_channel_difference(dialog_id, 0, MessageId(), 1.0, "after_get_channel_difference 2");
|
||||
}
|
||||
expected_channel_max_message_id_.erase(expected_channel_max_message_id_it);
|
||||
}
|
||||
|
@ -3028,7 +3028,7 @@ class MessagesManager final : public Actor {
|
||||
void update_expected_channel_max_message_id(DialogId dialog_id, MessageId expected_max_message_id);
|
||||
|
||||
void schedule_get_channel_difference(DialogId dialog_id, int32 expected_pts, MessageId expected_max_message_id,
|
||||
double delay);
|
||||
double delay, const char *source);
|
||||
|
||||
void get_channel_difference(DialogId dialog_id, int32 pts, int32 expected_pts, MessageId expected_max_message_id,
|
||||
bool force, const char *source, bool is_old = false);
|
||||
|
Loading…
Reference in New Issue
Block a user