File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -448,16 +448,14 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
448448 // if not redis error, fail the connection
449449 return hitlessHandshakeErr
450450 }
451- c .optLock .RLock ()
452- // handshake failed
451+ c .optLock .Lock ()
452+ // handshake failed - check and modify config atomically
453453 switch c .opt .HitlessUpgradeConfig .Enabled {
454454 case hitless .MaintNotificationsEnabled :
455455 // enabled mode, fail the connection
456- c .optLock .RUnlock ()
456+ c .optLock .Unlock ()
457457 return fmt .Errorf ("failed to enable maintenance notifications: %w" , hitlessHandshakeErr )
458458 default : // will handle auto and any other
459- c .optLock .RUnlock ()
460- c .optLock .Lock ()
461459 c .opt .HitlessUpgradeConfig .Enabled = hitless .MaintNotificationsDisabled
462460 c .optLock .Unlock ()
463461 // auto mode, disable hitless upgrades and continue
You can’t perform that action at this time.
0 commit comments