Add debug.

GitOrigin-RevId: 96ca16589f2d3e81aa1302be2af1cf4116db71b2
This commit is contained in:
levlam 2018-04-13 19:48:38 +03:00
parent ccdfac6926
commit ce7c410a5a

View File

@ -14304,6 +14304,7 @@ void MessagesManager::on_get_history_from_database(DialogId dialog_id, MessageId
Message *next_message = nullptr;
Dependencies dependencies;
bool is_first = true;
bool debug_have_full_history = d->have_full_history;
for (auto &message_slice : messages) {
if (!d->first_database_message_id.is_valid() && !d->have_full_history) {
break;
@ -14378,11 +14379,14 @@ void MessagesManager::on_get_history_from_database(DialogId dialog_id, MessageId
need_update_dialog_pos = true;
}
if (last_added_message_id.get() != d->last_database_message_id.get()) {
auto debug_last_database_message_id = d->last_database_message_id;
set_dialog_last_database_message_id(d, last_added_message_id, "on_get_history_from_database");
if (last_added_message_id.get() < d->first_database_message_id.get() ||
!d->first_database_message_id.is_valid()) {
CHECK(next_message != nullptr);
CHECK(d->have_full_history);
CHECK(d->have_full_history) << debug_have_full_history << " " << next_message->message_id << " "
<< last_added_message_id << " " << d->first_database_message_id << " "
<< debug_last_database_message_id;
CHECK(next_message->message_id.get() <= d->last_database_message_id.get());
LOG(ERROR) << "Fix first database message id in " << dialog_id << " from " << d->first_database_message_id
<< " to " << next_message->message_id;