Skip to content

Commit

Permalink
Don't call OnConnectFailed when failed to connect during shutdown (op…
Browse files Browse the repository at this point in the history
…en-telemetry#113)

Fixes open-telemetry#111

Once `Stop()` is called on the websocket client we don't call `OnConnectFailed` handler if a dial fails.

Tested this fix on a system that was repeatedly showing the `OnConnectFailed` handler called during shutdown.
  • Loading branch information
Corbin Phelps authored Jul 28, 2022
1 parent be3f3ff commit e3007c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/wsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (c *wsClient) tryConnectOnce(ctx context.Context) (err error, retryAfter sh
var resp *http.Response
conn, resp, err := c.dialer.DialContext(ctx, c.url.String(), c.requestHeader)
if err != nil {
if c.common.Callbacks != nil {
if c.common.Callbacks != nil && !c.common.IsStopping() {
c.common.Callbacks.OnConnectFailed(err)
}
if resp != nil {
Expand Down

0 comments on commit e3007c5

Please sign in to comment.