Synchronously preload web pages for messages loaded in on_get_history_from_database.
GitOrigin-RevId: 496e0a42324cbae0bb83e6c50bf977b4a97d7c2a
This commit is contained in:
parent
0e4e84235d
commit
bd145f18ac
@ -13107,6 +13107,12 @@ void MessagesManager::on_get_history_from_database(DialogId dialog_id, MessageId
|
||||
message->from_database = true;
|
||||
|
||||
auto old_message = get_message(d, message->message_id);
|
||||
if (old_message == nullptr && message->content->get_id() == MessageText::ID) {
|
||||
auto web_page_id = static_cast<const MessageText *>(message->content.get())->web_page_id;
|
||||
if (web_page_id.is_valid()) {
|
||||
td_->web_pages_manager_->have_web_page_force(web_page_id);
|
||||
}
|
||||
}
|
||||
Message *m = old_message ? old_message
|
||||
: add_message_to_dialog(d, std::move(message), false, &need_update,
|
||||
&need_update_dialog_pos, "on_get_history_from_database");
|
||||
@ -17572,6 +17578,7 @@ void MessagesManager::send_update_message_send_succeeded(Dialog *d, MessageId ol
|
||||
|
||||
void MessagesManager::send_update_message_content(DialogId dialog_id, MessageId message_id,
|
||||
const MessageContent *content, const char *source) const {
|
||||
LOG(INFO) << "Send updateMessageContent for " << message_id << " in " << dialog_id << " from " << source;
|
||||
CHECK(have_dialog(dialog_id)) << "Send updateMessageContent in unknown " << dialog_id << " from " << source
|
||||
<< " with load count " << loaded_dialogs_.count(dialog_id);
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
|
@ -1614,6 +1614,7 @@ void WebPagesManager::on_get_web_page_by_url(const string &url, WebPageId web_pa
|
||||
}
|
||||
|
||||
void WebPagesManager::wait_for_pending_web_page(DialogId dialog_id, MessageId message_id, WebPageId web_page_id) {
|
||||
LOG(INFO) << "Waiting for " << web_page_id << " needed in " << message_id << " in " << dialog_id;
|
||||
pending_web_pages_[web_page_id].emplace(dialog_id, message_id);
|
||||
pending_web_pages_timeout_.add_timeout_in(web_page_id.get(), 1.0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user