-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
How do I keep a PubSubConn alive when Sentinel is switching masters?
My current code panics right after the master goes down:
func NewRedisDataSub(pool *redis.Pool, subCh chan *msg.RedisMessage) {
c := pool.Get()
pubsub := redis.PubSubConn{Conn: c}
pubsub.Subscribe("data")
defer func() {
panic("Exited NewRedisDataSub")
}()
for {
switch v := pubsub.Receive().(type) {
case redis.Message:
// Handle message
case error:
log.Error(v)
return
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels