Do not try to load history in empty chats.
GitOrigin-RevId: 6ab22148eff7843abe251f7138e79f1f69f05b17
This commit is contained in:
parent
90cde3dea0
commit
b19dacf20b
@ -815,8 +815,8 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
|
|||||||
stmt.bind_int64(2, from_message_id).ensure();
|
stmt.bind_int64(2, from_message_id).ensure();
|
||||||
stmt.bind_int32(3, limit).ensure();
|
stmt.bind_int32(3, limit).ensure();
|
||||||
|
|
||||||
LOG(INFO) << "Load " << limit << " messages in " << DialogId(dialog_id) << " from " << MessageId(from_message_id)
|
LOG(INFO) << "Begin to load " << limit << " messages in " << DialogId(dialog_id) << " from "
|
||||||
<< " from database";
|
<< MessageId(from_message_id) << " from database";
|
||||||
std::vector<BufferSlice> result;
|
std::vector<BufferSlice> result;
|
||||||
stmt.step().ensure();
|
stmt.step().ensure();
|
||||||
while (stmt.has_row()) {
|
while (stmt.has_row()) {
|
||||||
|
@ -13128,8 +13128,9 @@ tl_object_ptr<td_api::messages> MessagesManager::get_dialog_history(DialogId dia
|
|||||||
CHECK(offset == 0);
|
CHECK(offset == 0);
|
||||||
preload_newer_messages(d, MessageId(messages[0]->id_));
|
preload_newer_messages(d, MessageId(messages[0]->id_));
|
||||||
preload_older_messages(d, MessageId(messages.back()->id_));
|
preload_older_messages(d, MessageId(messages.back()->id_));
|
||||||
} else if (messages.size() < static_cast<size_t>(limit) && left_tries != 0) {
|
} else if (messages.size() < static_cast<size_t>(limit) && left_tries != 0 &&
|
||||||
// there can be more messages on the server, need to load them
|
!(d->is_empty && d->have_full_history && left_tries < 3)) {
|
||||||
|
// there can be more messages in the database or on the server, need to load them
|
||||||
if (from_the_end) {
|
if (from_the_end) {
|
||||||
from_message_id = MessageId();
|
from_message_id = MessageId();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user