diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index a5e39e100..14969ea19 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -11634,7 +11634,10 @@ void MessagesManager::recalc_unread_count(DialogListId dialog_list_id, int32 old need_save = true; } } else { - repair_server_dialog_total_count(dialog_list_id); + if (list.server_dialog_total_count_ == -1) { + // recalc_unread_count is called only after getDialogs request; it is unneeded to call it again + repair_server_dialog_total_count(dialog_list_id); + } if (list.secret_chat_total_count_ == -1) { repair_secret_chat_total_count(dialog_list_id); @@ -14318,6 +14321,8 @@ void MessagesManager::on_get_dialogs(FolderId folder_id, vector(total_count)); CHECK(dialog_ids.size() <= static_cast(task.limit)); if (dialog_ids.size() == static_cast(min(total_count, task.limit)) || @@ -35229,7 +35234,7 @@ void MessagesManager::update_last_dialog_date(FolderId folder_id) { << folder->last_server_dialog_date_.get_dialog_id().get(); G()->td_db()->get_binlog_pmc()->set(PSTRING() << "last_server_dialog_date" << folder_id.get(), last_server_dialog_date_string); - LOG(INFO) << "Save last server dialog date " << last_server_dialog_date_string; + LOG(INFO) << "Save last server dialog date " << folder->last_server_dialog_date_; folder->last_database_server_dialog_date_ = folder->last_server_dialog_date_; folder->last_loaded_database_dialog_date_ = folder->last_server_dialog_date_; }