Skip to content

Commit

Permalink
honor the timer specified (#1672)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Jul 2, 2022
1 parent 1f9c275 commit 4aec031
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ func (c *Client) HealthCheck(hcDuration time.Duration) (context.CancelFunc, erro
atomic.StoreInt32(&c.healthStatus, unknown)
return
case <-timer.C:
timer.Reset(duration)
// Do health check the first time and ONLY if the connection is marked offline
if c.IsOffline() {
gctx, gcancel := context.WithTimeout(context.Background(), 3*time.Second)
Expand All @@ -394,6 +393,8 @@ func (c *Client) HealthCheck(hcDuration time.Duration) (context.CancelFunc, erro
atomic.CompareAndSwapInt32(&c.healthStatus, offline, online)
}
}

timer.Reset(duration)
}
}
}(hcDuration)
Expand Down

0 comments on commit 4aec031

Please sign in to comment.