Skip to content

Commit

Permalink
RSDK-840 removed redundant check connections (viamrobotics#1895)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviamiller authored Feb 17, 2023
1 parent 8ef24d3 commit 0a72d28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions robot/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,6 @@ func (rc *RobotClient) resources(ctx context.Context) ([]resource.Name, []resour
func (rc *RobotClient) Refresh(ctx context.Context) (err error) {
rc.mu.Lock()
defer rc.mu.Unlock()
if err := rc.checkConnected(); err != nil {
return err
}
return rc.updateResources(ctx, updateReasonRefresh)
}

Expand Down
6 changes: 6 additions & 0 deletions robot/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,12 @@ func TestNewRobotClientRefresh(t *testing.T) {
test.That(t, client, test.ShouldNotBeNil)
test.That(t, callCount, test.ShouldEqual, 1)

gServer.Stop()
test.That(t, <-client.Changed(), test.ShouldBeTrue)
test.That(t, client.Connected(), test.ShouldBeFalse)
err = client.Refresh(context.Background())
test.That(t, err.Error(), test.ShouldContainSubstring, "not connected to remote robot")

err = client.Close(context.Background())
test.That(t, err, test.ShouldBeNil)
}
Expand Down

0 comments on commit 0a72d28

Please sign in to comment.