-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add "WaitForReady" method #31
Conversation
This couples with the non-blocking start so that subsequent calls can wait for the dial to finish.
@@ -74,8 +76,15 @@ func WithWriteTimeout(d time.Duration) DialOption { | |||
}) | |||
} | |||
|
|||
func WithLogger(lggr logger.Logger) DialOption { |
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.
Actually might be preferable to just make it required.
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'd prefer to not make backwards incompatible changes here
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.
The current change is backwards-compatible.
@@ -454,7 +479,7 @@ func (ac *addrConn) resetTransport() { | |||
ac.mu.Unlock() | |||
|
|||
// Reconnection backoff time | |||
log.Println("[wsrpc] attempting reconnection in", backoffFor) | |||
ac.dopts.logger.Infof("attempting reconnection in %s", backoffFor) |
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.
Is it ok to use %s
here? backoffFor
is a time.Duration
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.
Yeah it will call .String()
and print a human readable duration
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.
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.
Looks good. Just one question on a log statement but otherwise looks good
This couples with the non-blocking start so that subsequent calls can
wait for the dial to finish.