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

Unified Diff: common/lhttp/client.go

Issue 2568953004: common/lhttp: only retry transient errors (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
« no previous file with comments | « no previous file | common/lhttp/client_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/lhttp/client.go
diff --git a/common/lhttp/client.go b/common/lhttp/client.go
index 080f4e1828f48dc894c3f5936c2ece396c3a76b1..2fa3a57dc98d2e160bceeafc958a84bdf3683397 100644
--- a/common/lhttp/client.go
+++ b/common/lhttp/client.go
@@ -39,9 +39,12 @@ type RequestGen func() (*http.Request, error)
// The handler func is responsible for closing the response Body before
// returning. It should return retry.Error in case of retriable error, for
// example if a TCP connection is terminated while receiving the content.
+//
+// If rFn is nil, NewRequest will use a default exponential backoff strategy only
dsansome-google 2016/12/13 02:36:14 Wrap to 80-chars like the other comments
+// for transient errors.
func NewRequest(ctx context.Context, c *http.Client, rFn retry.Factory, rgen RequestGen, handler Handler) func() (int, error) {
if rFn == nil {
- rFn = retry.Default
+ rFn = retry.TransientOnly(retry.Default)
}
return func() (int, error) {
« no previous file with comments | « no previous file | common/lhttp/client_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698