Remove uneeded third try in getWebPageInstantView.

This commit is contained in:
levlam 2021-10-07 13:00:41 +03:00
parent 2f4524a949
commit 4c803a1a75
3 changed files with 4 additions and 6 deletions

View File

@ -1606,7 +1606,7 @@ class GetWebPageInstantViewRequest final : public RequestActor<WebPageId> {
promise.set_value(std::move(web_page_id_)); promise.set_value(std::move(web_page_id_));
return; return;
} }
td->web_pages_manager_->get_web_page_instant_view(url_, force_full_, get_tries() < 3, std::move(promise)); td->web_pages_manager_->get_web_page_instant_view(url_, force_full_, std::move(promise));
} }
void do_set_result(WebPageId &&result) final { void do_set_result(WebPageId &&result) final {
@ -1620,7 +1620,6 @@ class GetWebPageInstantViewRequest final : public RequestActor<WebPageId> {
public: public:
GetWebPageInstantViewRequest(ActorShared<Td> td, uint64 request_id, string url, bool force_full) GetWebPageInstantViewRequest(ActorShared<Td> td, uint64 request_id, string url, bool force_full)
: RequestActor(std::move(td), request_id), url_(std::move(url)), force_full_(force_full) { : RequestActor(std::move(td), request_id), url_(std::move(url)), force_full_(force_full) {
set_tries(3);
} }
}; };

View File

@ -832,12 +832,11 @@ tl_object_ptr<td_api::webPage> WebPagesManager::get_web_page_preview_result(int6
return get_web_page_object(web_page_id); return get_web_page_object(web_page_id);
} }
void WebPagesManager::get_web_page_instant_view(const string &url, bool force_full, bool force, void WebPagesManager::get_web_page_instant_view(const string &url, bool force_full, Promise<WebPageId> &&promise) {
Promise<WebPageId> &&promise) {
LOG(INFO) << "Trying to get web page instant view for the url \"" << url << '"'; LOG(INFO) << "Trying to get web page instant view for the url \"" << url << '"';
auto it = url_to_web_page_id_.find(url); auto it = url_to_web_page_id_.find(url);
if (it != url_to_web_page_id_.end()) { if (it != url_to_web_page_id_.end()) {
if (it->second == WebPageId() && !force) { if (it->second == WebPageId()) {
// ignore negative caching // ignore negative caching
return reload_web_page_by_url(url, std::move(promise)); return reload_web_page_by_url(url, std::move(promise));
} }

View File

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