1
0
mirror of https://github.com/redis/go-redis.git synced 2025-10-18 22:08:50 +03:00

better conn usable timeout

This commit is contained in:
Nedyalko Dyakov
2025-10-14 23:06:36 +03:00
parent 6c54ab59d9
commit 90bfdb3aa3
3 changed files with 34 additions and 11 deletions

View File

@@ -319,6 +319,12 @@ func (c *baseClient) connReAuthCredentialsListener(poolCn *pool.Conn) (auth.Cred
c.reAuthConnection(),
c.onAuthenticationErr(),
)
// main case where the connection can be stuck in the listener for a long time is when we have a handoff
// so we set the checkUsableTimeout to the handoff timeout if maintnotifications are enabled
// the default timeout if no maintnotifications config is provided is 1 second
if c.opt.MaintNotificationsConfig != nil && c.opt.MaintNotificationsConfig.Mode != maintnotifications.ModeDisabled {
newCredListener.SetCheckUsableTimeout(c.opt.MaintNotificationsConfig.HandoffTimeout)
}
c.credListeners[poolCn] = newCredListener
return newCredListener, func() {
c.removeCredListener(poolCn)