fixup set connected in hook
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
24f9f41de4
commit
27bd074a2f
9
event.go
9
event.go
@ -22,8 +22,13 @@ func newEventHook(connected *atomic.Bool) *eventHook {
|
||||
func (h *eventHook) DialHook(hook goredis.DialHook) goredis.DialHook {
|
||||
return func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
conn, err := hook(ctx, network, addr)
|
||||
if err != nil && !isRedisError(err) {
|
||||
h.connected.Store(false)
|
||||
if err != nil {
|
||||
if !isRedisError(err) {
|
||||
h.connected.Store(false)
|
||||
}
|
||||
h.connected.Store(true)
|
||||
} else {
|
||||
h.connected.Store(true)
|
||||
}
|
||||
return conn, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user