-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: retryable http client #398
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. Just left some initial review comments. I will continue reviewing later.
The |
@souleb The root cause of the error is that Please check the following changes: diff --git a/example_test.go b/example_test.go
index c1e4c20..82fa126 100644
--- a/example_test.go
+++ b/example_test.go
@@ -182,7 +182,7 @@ func TestMain(m *testing.M) {
panic(err)
}
remoteHost = u.Host
- http.DefaultClient = httpsServer.Client()
+ http.DefaultTransport = httpsServer.Client().Transport
os.Exit(m.Run())
}
diff --git a/registry/example_test.go b/registry/example_test.go
index 70f102c..2463667 100644
--- a/registry/example_test.go
+++ b/registry/example_test.go
@@ -65,7 +65,7 @@ func TestMain(m *testing.M) {
panic(err)
}
host = u.Host
- http.DefaultClient = ts.Client()
+ http.DefaultTransport = ts.Client().Transport
os.Exit(m.Run())
}
diff --git a/registry/remote/example_test.go b/registry/remote/example_test.go
index bbd292e..370486d 100644
--- a/registry/remote/example_test.go
+++ b/registry/remote/example_test.go
@@ -214,7 +214,7 @@ func TestMain(m *testing.M) {
panic(err)
}
host = u.Host
- http.DefaultClient = ts.Client()
+ http.DefaultTransport = ts.Client().Transport
os.Exit(m.Run())
} |
Codecov Report
@@ Coverage Diff @@
## main #398 +/- ##
==========================================
+ Coverage 72.31% 72.34% +0.02%
==========================================
Files 46 48 +2
Lines 4349 4444 +95
==========================================
+ Hits 3145 3215 +70
- Misses 903 921 +18
- Partials 301 308 +7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
5c7b9d7
to
afe215f
Compare
ae4410d
to
f9a9bc8
Compare
If implemented, this will provide a default http client with retry. The retry function is an exponential back off 0.25s * 2^n ± 10% and max 5 attempts. The client is the default client of `auth.Client` Co-authored-by: Shiwei Zhang <shizh@microsoft.com> Signed-off-by: Soule BA <bah.soule@gmail.com>
…ultClient Signed-off-by: Soule BA <bah.soule@gmail.com>
Better backoff function that rely accounts for ± 10% jitter Signed-off-by: Soule BA <bah.soule@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fixes #147
If implemented, this will provide a default http client with retry.
The retry function is an exponential back off 0.25s * 2^n ± 10% and max 5 attempts.
The client is the default client of
auth.Client
Co-authored-by: Shiwei Zhang shizh@microsoft.com
Signed-off-by: Soule BA bah.soule@gmail.com
cc @shizhMSFT