-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Remove oxy connections limiter #46900
Conversation
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
f7c2646
to
55025b3
Compare
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
|
||
// Wrap wraps an HTTP handler. | ||
func (l *ConnectionsLimiter) Wrap(h http.Handler) { | ||
l.next = h |
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.
I don't like this approach, a second call to Wrap is going to overwrite the first one and we might do that by accident, we could return a http.Handler
from Wrap
instead (with an inline http.HandlerFunc
maybe):
func (l *ConnectionsLimiter) Wrap(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
token, _, err := net.SplitHostPort(r.RemoteAddr)
...
if err := l.AcquireConnection(token); err != nil {
...
}
defer l.ReleaseConnection(token)
next.ServeHTTP(w, r)
})
}
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.
I don't love it either, it's just how this code already worked.
55025b3
to
57f2bec
Compare
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
57f2bec
to
b5dea7c
Compare
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
b5dea7c
to
ccc4e63
Compare
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
ccc4e63
to
12db2df
Compare
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
lib/limiter composes a maximum simultaneous connections limiter as well as a rate limiter. This commit replaces the connections limiter from oxy with built-in code. Note: this also introduces a bug fix that may change behavior. Prior to this change, the connection limiter kept a separate connection account for HTTP connections than it did for connections managed manually with acquire/release. We no longer maintain separate counts - all connections (HTTP or not) contribute to the number of allowed connections.
12db2df
to
7b8573e
Compare
lib/limiter composes a maximum simultaneous connections limiter as well as a rate limiter. This commit replaces the connections limiter from oxy with built-in code.
Note: this also introduces a bug fix that may change behavior. Prior to this change, the connection limiter kept a separate connection account for HTTP connections than it did for connections managed manually with acquire/release. We no longer maintain separate counts - all connections (HTTP or not) contribute to the number of allowed connections.