Skip to content

Commit 24ba3cf

Browse files
committed
pubsub: fix ping logic
1 parent 70377a6 commit 24ba3cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pubsub.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ func (c *PubSub) initChannel() {
435435
timer := time.NewTimer(timeout)
436436
timer.Stop()
437437

438-
var healthy bool
438+
healthy := true
439439
var pingErr error
440440
for {
441441
timer.Reset(timeout)
@@ -446,9 +446,9 @@ func (c *PubSub) initChannel() {
446446
<-timer.C
447447
}
448448
case <-timer.C:
449+
pingErr = c.Ping()
449450
if healthy {
450451
healthy = false
451-
pingErr = c.Ping()
452452
} else {
453453
c.mu.Lock()
454454
c._reconnect(pingErr)

0 commit comments

Comments
 (0)