Improve log messages.

This commit is contained in:
levlam 2021-01-08 16:05:16 +03:00
parent c271524019
commit c5549b7346
3 changed files with 40 additions and 2 deletions

View File

@ -6143,6 +6143,23 @@ void MessagesManager::skip_old_pending_update(tl_object_ptr<telegram_api::Update
<< "Receive useless update " << oneline(to_string(update)) << " from " << source; << "Receive useless update " << oneline(to_string(update)) << " from " << source;
} }
int32 MessagesManager::get_min_pending_pts() const {
int32 result = std::numeric_limits<int32>::max();
if (!pending_pts_updates_.empty()) {
auto pts = pending_pts_updates_.begin()->first;
if (pts < result) {
result = pts;
}
}
if (!postponed_pts_updates_.empty()) {
auto pts = postponed_pts_updates_.begin()->first;
if (pts < result) {
result = pts;
}
}
return result;
}
void MessagesManager::add_pending_update(tl_object_ptr<telegram_api::Update> &&update, int32 new_pts, int32 pts_count, void MessagesManager::add_pending_update(tl_object_ptr<telegram_api::Update> &&update, int32 new_pts, int32 pts_count,
bool force_apply, Promise<Unit> &&promise, const char *source) { bool force_apply, Promise<Unit> &&promise, const char *source) {
// do not try to run getDifference from this function // do not try to run getDifference from this function

View File

@ -788,6 +788,8 @@ class MessagesManager : public Actor {
tl_object_ptr<td_api::messages> get_messages_object(int32 total_count, const vector<FullMessageId> &full_message_ids, tl_object_ptr<td_api::messages> get_messages_object(int32 total_count, const vector<FullMessageId> &full_message_ids,
bool skip_not_found); bool skip_not_found);
int32 get_min_pending_pts() const;
void add_pending_update(tl_object_ptr<telegram_api::Update> &&update, int32 new_pts, int32 pts_count, void add_pending_update(tl_object_ptr<telegram_api::Update> &&update, int32 new_pts, int32 pts_count,
bool force_apply, Promise<Unit> &&promise, const char *source); bool force_apply, Promise<Unit> &&promise, const char *source);

View File

@ -183,11 +183,30 @@ void UpdatesManager::tear_down() {
} }
void UpdatesManager::fill_pts_gap(void *td) { void UpdatesManager::fill_pts_gap(void *td) {
fill_gap(td, "pts"); CHECK(td != nullptr);
if (G()->close_flag()) {
return;
}
auto td_ptr = static_cast<Td *>(td);
string source = PSTRING() << "pts from " << td_ptr->updates_manager_->get_pts() << " to "
<< td_ptr->messages_manager_->get_min_pending_pts();
fill_gap(td, source.c_str());
} }
void UpdatesManager::fill_seq_gap(void *td) { void UpdatesManager::fill_seq_gap(void *td) {
fill_gap(td, "seq"); CHECK(td != nullptr);
if (G()->close_flag()) {
return;
}
auto td_ptr = static_cast<Td *>(td);
auto seq = std::numeric_limits<int32>::max();
if (!td_ptr->updates_manager_->pending_seq_updates_.empty()) {
seq = td_ptr->updates_manager_->pending_seq_updates_.begin()->first;
}
string source = PSTRING() << "seq from " << td_ptr->updates_manager_->seq_ << " to " << seq;
fill_gap(td, source.c_str());
} }
void UpdatesManager::fill_qts_gap(void *td) { void UpdatesManager::fill_qts_gap(void *td) {