forked from mirror/redis
pubsub: fix ping logic
This commit is contained in:
parent
e753829945
commit
e3b56f7641
|
@ -435,7 +435,7 @@ func (c *PubSub) initChannel() {
|
||||||
timer := time.NewTimer(timeout)
|
timer := time.NewTimer(timeout)
|
||||||
timer.Stop()
|
timer.Stop()
|
||||||
|
|
||||||
var healthy bool
|
healthy := true
|
||||||
var pingErr error
|
var pingErr error
|
||||||
for {
|
for {
|
||||||
timer.Reset(timeout)
|
timer.Reset(timeout)
|
||||||
|
@ -446,9 +446,9 @@ func (c *PubSub) initChannel() {
|
||||||
<-timer.C
|
<-timer.C
|
||||||
}
|
}
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
|
pingErr = c.Ping()
|
||||||
if healthy {
|
if healthy {
|
||||||
healthy = false
|
healthy = false
|
||||||
pingErr = c.Ping()
|
|
||||||
} else {
|
} else {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
c._reconnect(pingErr)
|
c._reconnect(pingErr)
|
||||||
|
|
Loading…
Reference in New Issue