Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: components/ntp_snippets/remote/ntp_snippets_fetcher.cc

Issue 2548343002: NTPSnippets: Set MaxRetriesOn5xx only for interactive requests. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/remote/ntp_snippets_fetcher.cc
diff --git a/components/ntp_snippets/remote/ntp_snippets_fetcher.cc b/components/ntp_snippets/remote/ntp_snippets_fetcher.cc
index 62236a8a375cab50981b1a7798b0ce55f963798c..8aa0580e0b3e85259f478744d7cf94a1e76b07d1 100644
--- a/components/ntp_snippets/remote/ntp_snippets_fetcher.cc
+++ b/components/ntp_snippets/remote/ntp_snippets_fetcher.cc
@@ -661,6 +661,13 @@ NTPSnippetsFetcher::RequestBuilder::SetUserClassifier(
return *this;
}
+std::unique_ptr<net::URLFetcher>
+NTPSnippetsFetcher::RequestBuilder::PreviewURLFetcherForTesting() const {
+ return BuildURLFetcher(/*request=*/nullptr, // Can never be called anyways.
tschumann 2016/12/05 17:26:33 this is a smell. If you really need something like
fhorschig 2016/12/06 14:31:40 Removed. As noted in your last comment, this was e
+ /*headers=*/"", // Can be set later if needed.
+ /*body=*/""); // Can be set later if needed.
+}
+
bool NTPSnippetsFetcher::RequestBuilder::IsSendingTopLanguagesEnabled() const {
return IsBooleanParameterEnabled(kSendTopLanguagesName,
/*default_value=*/false);
@@ -812,8 +819,14 @@ NTPSnippetsFetcher::RequestBuilder::BuildURLFetcher(
// Fetchers are sometimes cancelled because a network change was detected.
url_fetcher->SetAutomaticallyRetryOnNetworkChanges(3);
- // Try to make fetching the files bit more robust even with poor connection.
- url_fetcher->SetMaxRetriesOn5xx(3);
+ if (params_.interactive_request) {
+ // Try to make fetching the files bit more robust even with poor connection.
+ url_fetcher->SetMaxRetriesOn5xx(2);
+ } else {
+ // Don't retry immediately if a scheduled fetch fails.
+ // TODO(fhorschig): back off for 1h (+1h jitter) and then retry.
+ url_fetcher->SetMaxRetriesOn5xx(0);
+ }
return url_fetcher;
}

Powered by Google App Engine
This is Rietveld 408576698