diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index f958ac291..acf469342 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -1883,7 +1883,8 @@ class GetWebPageInstantViewRequest : public RequestActor<> { WebPageId web_page_id_; void do_run(Promise &&promise) override { - web_page_id_ = td->web_pages_manager_->get_web_page_instant_view(url_, force_full_, std::move(promise)); + web_page_id_ = + td->web_pages_manager_->get_web_page_instant_view(url_, force_full_, get_tries() < 3, std::move(promise)); } void do_send_result() override { diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index acebe2a0f..36a9cd032 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -1733,10 +1733,16 @@ tl_object_ptr WebPagesManager::get_web_page_preview_result(int6 return get_web_page_object(web_page_id); } -WebPageId WebPagesManager::get_web_page_instant_view(const string &url, bool force_full, Promise &&promise) { +WebPageId WebPagesManager::get_web_page_instant_view(const string &url, bool force_full, bool force, + Promise &&promise) { LOG(INFO) << "Trying to get web page instant view for the url \"" << url << '"'; auto it = url_to_web_page_id_.find(url); if (it != url_to_web_page_id_.end()) { + if (it->second == WebPageId() && !force) { + // ignore negative caching + reload_web_page_by_url(url, std::move(promise)); + return WebPageId(); + } return get_web_page_instant_view(it->second, force_full, std::move(promise)); } diff --git a/td/telegram/WebPagesManager.h b/td/telegram/WebPagesManager.h index 7c491a8f7..360a6f409 100644 --- a/td/telegram/WebPagesManager.h +++ b/td/telegram/WebPagesManager.h @@ -60,7 +60,7 @@ class WebPagesManager : public Actor { tl_object_ptr get_web_page_preview_result(int64 request_id); - WebPageId get_web_page_instant_view(const string &url, bool force_full, Promise &&promise); + WebPageId get_web_page_instant_view(const string &url, bool force_full, bool force, Promise &&promise); WebPageId get_web_page_by_url(const string &url) const;