-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
api: use singleflight for /info endpoint #45847
Conversation
version := httputils.VersionFromContext(ctx) | ||
if versions.LessThan(version, "1.25") { |
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.
Hm.. so thinking about this; if info
(as returned above) is gonna be shared, and it's a pointer, then I guess the steps below wouldn't really work (as they would now modify all requests?
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.
Fixed this by using the API version as key for the single-flight
af0f982
to
ececb80
Compare
Prevent potential suggestion when many concurrent requests happen on the /info endpoint. It's worth noting that with this change, requests to the endpoint while another request is still in flight will share the results, hence might be slightly incorrect (for example, the output includes SystemTime, which may now be incorrect). Assuming that under normal circumstances, requests will still happen fast enough to not be shared, this may not be a problem, but we could decide to update specific fields to not be shared. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
ececb80
to
a1c9a68
Compare
Rebased; this now only contains the singleflight changes |
For reviewers; this one is easiest to review with "whitespace" hidden in the diff; use this link to hide whitespace in the diff; https://github.com/moby/moby/pull/45847/files?w=1 |
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.
Still LGTM
Let me bring this one in; we discussed this PR in a maintainers call;
|
Prevent potential suggestion when many concurrent requests happen on the /info endpoint. It's worth noting that with this change, requests to the endpoint while another request is still in flight will share the results, hence might be slightly incorrect (for example, the output includes SystemTime, which may now be incorrect).
Assuming that under normal circumstances, requests will still happen fast enough to not be shared, this may not be a problem, but we could decide to update specific fields to not be shared.
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)