-
Notifications
You must be signed in to change notification settings - Fork 111
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
[RSDK-491]Retry reconnecting and checking connection by default #1499
[RSDK-491]Retry reconnecting and checking connection by default #1499
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.
logic in dialRobotClient
should also be simplified - only add the relevant client option if the value is not 0.
robot/client/client.go
Outdated
} | ||
var reconnectTime time.Duration | ||
if rOpts.refreshEvery == nil { | ||
reconnectTime = 10 * time.Second |
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.
use the defaults from dialRobotClient
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.
Could you elaborate a bit more? I think I may have fixed 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.
the defaults should be 10 seconds for checkConnectedTime and 1 second for reconnect time
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.
So just to confirm 10 for refreshTime and checkConnectedTime. 1 second for reconnectTime?
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.
yep
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.
cool cool, fixed
robot/client/client_options.go
Outdated
@@ -15,12 +15,14 @@ type robotClientOpts struct { | |||
refreshEvery *time.Duration | |||
|
|||
// checkConnectedEvery is how often to check connection to the | |||
// robot. If unset, it will not be checked automatically. | |||
checkConnectedEvery time.Duration | |||
// robot. If <0, it will not be refreshed automatically, if unset, |
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.
fixed
robot/client/client_options.go
Outdated
|
||
// reconnectEvery is how often to try reconnecting the | ||
// robot. If unset, it will not be reconnected automatically. | ||
reconnectEvery time.Duration | ||
// robot. If <0, it will not be refreshed automatically, if unset, |
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.
fixed
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 you also update the < for refreshEvery?
…and-checking-connection
…esh as something that can be specified in config
…and-checking-connection
I cleaned up dialRobotClient and added RefreshInterval to the remote config as well. |
config/config.go
Outdated
@@ -128,6 +128,7 @@ type Remote struct { | |||
Insecure bool `json:"insecure"` | |||
ConnectionCheckInterval time.Duration `json:"connection_check_interval,omitempty"` | |||
ReconnectInterval time.Duration `json:"reconnect_interval,omitempty"` | |||
RefreshInterval time.Duration `json:"refresh_interval,omitempty"` |
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.
while I agree with this change, you will also have to make changes to proto_conversion.go plus the api repo (since the remote config proto will have changed) and then update the app repo after that. so we can leave this change out of this PR and make a ticket or make the rest of the changes too
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.
👍 makes sense, ill remove it
robot/client/client.go
Outdated
} | ||
var reconnectTime time.Duration | ||
if rOpts.refreshEvery == nil { | ||
reconnectTime = 10 * time.Second |
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 defaults should be 10 seconds for checkConnectedTime and 1 second for reconnect time
connectionCheckInterval := config.ConnectionCheckInterval | ||
if connectionCheckInterval == 0 { | ||
connectionCheckInterval = 10 * time.Second | ||
rOpts := []client.RobotClientOption{client.WithDialOptions(dialOpts...)} |
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 great!
…and-checking-connection
|
similar to how we make clients refresh by default, we are doing the same for reconnecting and checking connection status