Ignore negative cache in getWebPageInstantView.

GitOrigin-RevId: 3d4b5f4db209e6c82ed576360ef5867f2c85b9a7
This commit is contained in:
levlam 2018-04-22 20:26:00 +03:00
parent 8fdb19e06e
commit 8cb1a682cc
3 changed files with 10 additions and 3 deletions

View File

@ -1883,7 +1883,8 @@ class GetWebPageInstantViewRequest : public RequestActor<> {
WebPageId web_page_id_;
void do_run(Promise<Unit> &&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 {

View File

@ -1733,10 +1733,16 @@ tl_object_ptr<td_api::webPage> 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<Unit> &&promise) {
WebPageId WebPagesManager::get_web_page_instant_view(const string &url, bool force_full, bool force,
Promise<Unit> &&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));
}

View File

@ -60,7 +60,7 @@ class WebPagesManager : public Actor {
tl_object_ptr<td_api::webPage> get_web_page_preview_result(int64 request_id);
WebPageId get_web_page_instant_view(const string &url, bool force_full, Promise<Unit> &&promise);
WebPageId get_web_page_instant_view(const string &url, bool force_full, bool force, Promise<Unit> &&promise);
WebPageId get_web_page_by_url(const string &url) const;