mirror of
https://github.com/redis/go-redis.git
synced 2025-04-17 20:17:02 +03:00
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.Stop()
|
||||
|
||||
var healthy bool
|
||||
healthy := true
|
||||
var pingErr error
|
||||
for {
|
||||
timer.Reset(timeout)
|
||||
@ -446,9 +446,9 @@ func (c *PubSub) initChannel() {
|
||||
<-timer.C
|
||||
}
|
||||
case <-timer.C:
|
||||
pingErr = c.Ping()
|
||||
if healthy {
|
||||
healthy = false
|
||||
pingErr = c.Ping()
|
||||
} else {
|
||||
c.mu.Lock()
|
||||
c._reconnect(pingErr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user