Commit 0c88d2db authored by Benoit Lize's avatar Benoit Lize Committed by Commit Bot

android: Retry detached requests on network change.

Some detached requests fail because the network changes between
requests. Retry the request in this case, only once.

Bug: 851399
Change-Id: Ic77c28e5ac49fecaf634e4a225c8f443f75e2560
Reviewed-on: https://chromium-review.googlesource.com/1118262Reviewed-by: default avatarMichael van Ouwerkerk <mvanouwerkerk@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571173}
parent 3f461fd2
...@@ -106,6 +106,10 @@ void DetachedResourceRequest::Start( ...@@ -106,6 +106,10 @@ void DetachedResourceRequest::Start(
request->url_loader_->SetOnRedirectCallback( request->url_loader_->SetOnRedirectCallback(
base::BindRepeating(&DetachedResourceRequest::OnRedirectCallback, base::BindRepeating(&DetachedResourceRequest::OnRedirectCallback,
base::Unretained(request.get()))); base::Unretained(request.get())));
// Only retry on network changes, not HTTP 5xx codes. This is a client-side
// failure, and main requests are retried in this case.
request->url_loader_->SetRetryOptions(
1 /* max_retries */, network::SimpleURLLoader::RETRY_ON_NETWORK_CHANGE);
// |url_loader_| is owned by the request, and must be kept alive to not cancel // |url_loader_| is owned by the request, and must be kept alive to not cancel
// the request. Pass the ownership of the request to the response callback, // the request. Pass the ownership of the request to the response callback,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment