Skip to content
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

Merged
merged 2 commits into from
Mar 7, 2023
Merged

Add "WaitForReady" method #31

merged 2 commits into from
Mar 7, 2023

Conversation

samsondav
Copy link
Contributor

This couples with the non-blocking start so that subsequent calls can
wait for the dial to finish.

This couples with the non-blocking start so that subsequent calls can
wait for the dial to finish.
jkongie
jkongie previously approved these changes Mar 6, 2023
@@ -74,8 +76,15 @@ func WithWriteTimeout(d time.Duration) DialOption {
})
}

func WithLogger(lggr logger.Logger) DialOption {
Copy link
Contributor Author

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.

Copy link
Collaborator

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

Copy link
Contributor Author

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)
Copy link
Collaborator

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

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@jkongie jkongie left a 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

@samsondav samsondav requested a review from jkongie March 7, 2023 14:28
@samsondav samsondav merged commit d7d5168 into main Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants