Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
7fc5a26347 |
7
event.go
7
event.go
@@ -22,9 +22,14 @@ func newEventHook(connected *atomic.Bool) *eventHook {
|
|||||||
func (h *eventHook) DialHook(hook goredis.DialHook) goredis.DialHook {
|
func (h *eventHook) DialHook(hook goredis.DialHook) goredis.DialHook {
|
||||||
return func(ctx context.Context, network, addr string) (net.Conn, error) {
|
return func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
conn, err := hook(ctx, network, addr)
|
conn, err := hook(ctx, network, addr)
|
||||||
if err != nil && !isRedisError(err) {
|
if err != nil {
|
||||||
|
if !isRedisError(err) {
|
||||||
h.connected.Store(false)
|
h.connected.Store(false)
|
||||||
}
|
}
|
||||||
|
h.connected.Store(true)
|
||||||
|
} else {
|
||||||
|
h.connected.Store(true)
|
||||||
|
}
|
||||||
return conn, err
|
return conn, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user