Drop definitely incorrect folder.last_database_server_dialog_date_.

This commit is contained in:
levlam 2021-12-24 23:18:40 +03:00
parent 9cf4851c5b
commit b24c188ac0
2 changed files with 9 additions and 0 deletions

View File

@ -252,6 +252,8 @@ class DialogDbImpl final : public DialogDbSyncInterface {
get_dialogs_stmt_.bind_int32(4, limit).ensure();
DialogDbGetDialogsResult result;
result.next_dialog_id = dialog_id;
result.next_order = order;
TRY_STATUS(get_dialogs_stmt_.step());
while (get_dialogs_stmt_.has_row()) {
BufferSlice data(get_dialogs_stmt_.view_blob(0));

View File

@ -16167,6 +16167,13 @@ void MessagesManager::on_get_dialogs_from_database(FolderId folder_id, int32 lim
if (!have_more_dialogs_in_database) {
folder.last_loaded_database_dialog_date_ = MAX_DIALOG_DATE;
LOG(INFO) << "Set last loaded database dialog date to " << folder.last_loaded_database_dialog_date_;
if (folder.last_database_server_dialog_date_.get_date() == 0 &&
folder.last_database_server_dialog_date_ != MAX_DIALOG_DATE) {
// replace definitely wrong folder.last_database_server_dialog_date_ with max_dialog_date
LOG(ERROR) << "Fix last database server dialog date from " << folder.last_database_server_dialog_date_ << " to "
<< max_dialog_date;
folder.last_database_server_dialog_date_ = max_dialog_date;
}
folder.last_server_dialog_date_ = max(folder.last_server_dialog_date_, folder.last_database_server_dialog_date_);
LOG(INFO) << "Set last server dialog date to " << folder.last_server_dialog_date_;
update_last_dialog_date(folder_id);