-
Notifications
You must be signed in to change notification settings - Fork 169
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
Improve reconnect randomization #868
base: main
Are you sure you want to change the base?
Conversation
1c65c0b
to
a721429
Compare
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.
Some nits
@@ -99,8 +101,13 @@ impl Connector { | |||
|
|||
pub(crate) async fn try_connect(&mut self) -> Result<(ServerInfo, Connection), io::Error> { | |||
let mut error = None; | |||
let server_addrs = { | |||
let mut rng = thread_rng(); |
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.
This is already mut, so connector could own the rng without issue.
let mut rng = thread_rng(); | |
let mut rng = thread_rng(); |
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.
Not sure.
Connector needs to be Send
.
Do we prefer to just call it at try_connect
or put it behind Arc
?
I think the former.
a721429
to
f432fa4
Compare
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
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
f432fa4
to
bcf5ca6
Compare
No description provided.