-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
client: reset backoff to 0 after a connection is established #2669
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1032,6 +1032,7 @@ func (ac *addrConn) resetTransport() { | |
continue | ||
} | ||
|
||
backoffFor = 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, this should also reset EDIT: Oh we already do this below; maybe we should move it up here though for consistency and to avoid taking the lock an extra time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have cleanup changes in another branch, was trying to keep this change simple so we can cherrypick it to previous releases. |
||
ac.mu.Lock() | ||
ac.curAddr = addr | ||
ac.transport = newTr | ||
|
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.
It works fine for us to reconnect immediately after connection closed.
But I think this also resets backoff duration when reconnecting failed repeated in the server down, which resulted in trying to reconnect aggressively.
So the backoff duration should be reset only in first retry like this?
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.
If reconnecting failed, we will
continue
above, and won't reach this.This only happens when we successfully create a connection, and we want to skip any backoff if this connection breaks.
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.
sorry it's my bad. I tried again with this branch and it does retry to connect with backoff correctly.