Skip to content

Commit

Permalink
update testOnBorrow
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Mar 10, 2016
1 parent 20da63c commit 86169e9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libcentrifugo/engineredis.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,15 @@ func newPool(conf *RedisEngineConfig) *redis.Pool {
return c, err
},
TestOnBorrow: func(c redis.Conn, t time.Time) error {
if !sentinel.TestRole(c, "master") {
return errors.New("Failed role check")
if useSentinel {
if !sentinel.TestRole(c, "master") {
return errors.New("Failed master role check")
} else {
return nil
}
} else {
return nil
_, err := c.Do("PING")
return err
}
},
}
Expand Down

0 comments on commit 86169e9

Please sign in to comment.