-
Notifications
You must be signed in to change notification settings - Fork 51
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
node, sdk/node: add options to configure reconnection backoff #11
base: master
Are you sure you want to change the base?
Conversation
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.
Can 0 be no reconnect and -1 be forever retry?
Services map[string]flatend.Handler | ||
|
||
// Total number of attempts to reconnect to a peer we reached that disconnected. | ||
// Default is 8 attempts, set to a negative integer to not attempt to reconnect at all. |
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.
Can 0 be no reconnect and -1 be forever retry?
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 tried to figure a way to do that, though I wonder how we could force the default value for NumReconnectAttempts to be 8 in that case. The only idiomatic way I could think of is to switch to functional options, or to encapsulate options into a separate Options struct with sensible defaults, though might you have any suggestions?
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.
When I do services in Go, typically I create some kind of config object which can be use by main.go
. So the main program is the one that is setting the defaults. User can then set parameters on main.go
to override the defaults.
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.
@lithdew Why did you choose 8 as default?
…0 will attempt to retry infinitely
Fixes #10.