Do not send getHistory requests when closing.

GitOrigin-RevId: ea9e71fda1367ba639521e236a5dd57d0fbe2392
This commit is contained in:
levlam 2019-04-06 01:04:30 +03:00
parent f4472452dc
commit 83dfa3ba0b

View File

@ -14946,6 +14946,9 @@ void MessagesManager::get_history_from_the_end(DialogId dialog_id, bool from_dat
// can't get history in dialogs without read access
return promise.set_value(Unit());
}
if (G()->close_flag()) {
return promise.set_error(Status::Error(500, "Request aborted"));
}
const int32 limit = MAX_GET_HISTORY;
if (from_database && G()->parameters().use_message_db) {
LOG(INFO) << "Get history from the end of " << dialog_id << " from database";
@ -14977,6 +14980,9 @@ void MessagesManager::get_history(DialogId dialog_id, MessageId from_message_id,
// can't get history in dialogs without read access
return promise.set_value(Unit());
}
if (G()->close_flag()) {
return promise.set_error(Status::Error(500, "Request aborted"));
}
if (from_database && G()->parameters().use_message_db) {
LOG(INFO) << "Get history in " << dialog_id << " from " << from_message_id << " with offset " << offset
<< " and limit " << limit << " from database";