DialogDb, MessageDb, MessagesManager: abort if an error happens during a transaction

GitOrigin-RevId: 63751130e05ed6d37928646c9a89ff35166e78e8
This commit is contained in:
Arseny Smirnov 2020-07-27 18:03:22 +03:00
parent 41cac3edba
commit 166682865a
3 changed files with 5 additions and 0 deletions

View File

@ -386,6 +386,8 @@ class DialogDbAsync : public DialogDbAsyncInterface {
}
void on_write_result(Promise<> promise, Status status) {
// We are inside a transaction and don't know how to handle the error
status.ensure();
pending_write_results_.emplace_back(std::move(promise), std::move(status));
}

View File

@ -1035,6 +1035,8 @@ class MessagesDbAsync : public MessagesDbAsyncInterface {
});
}
void on_write_result(Promise<> promise, Status status) {
// We are inside a transaction and don't know how to handle the error
status.ensure();
pending_write_results_.emplace_back(std::move(promise), std::move(status));
}
void delete_all_dialog_messages(DialogId dialog_id, MessageId from_message_id, Promise<> promise) {

View File

@ -23779,6 +23779,7 @@ MessagesManager::MessageNotificationGroup MessagesManager::get_message_notificat
VLOG(notifications) << "Loaded " << r_value.ok() << " from database by " << group_id;
d = get_dialog_force(r_value.ok().dialog_id);
} else {
CHECK(r_value.error().message() == "Not found");
VLOG(notifications) << "Failed to load " << group_id << " from database";
}
G()->td_db()->get_dialog_db_sync()->commit_transaction().ensure();