Skip to content

Commit 3c40e22

Browse files
committed
deadlock?
1 parent 49a2e43 commit 3c40e22

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

async_handoff_integration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ func TestEventDrivenHandoffIntegration(t *testing.T) {
269269
}
270270

271271
processor := hitless.NewPoolHook(slowDialer, "tcp", nil, nil)
272+
defer processor.Shutdown(context.Background())
272273

273274
// Create hooks manager and add processor as hook
274275
hookManager := pool.NewPoolHookManager()

hitless/hitless_manager.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"github.com/redis/go-redis/v9/internal/pool"
1414
)
1515

16+
17+
1618
// Push notification type constants for hitless upgrades
1719
const (
1820
NotificationMoving = "MOVING"

redis.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,17 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
448448
}
449449

450450
// Enable maintenance notifications if hitless upgrades are configured
451-
if c.opt.HitlessUpgradeConfig.IsEnabled() && c.opt.Protocol == 3 {
451+
c.optLock.RLock()
452+
hitlessEnabled := c.opt.HitlessUpgradeConfig.IsEnabled()
453+
protocol := c.opt.Protocol
454+
endpointType := c.opt.HitlessUpgradeConfig.EndpointType
455+
c.optLock.RUnlock()
456+
457+
if hitlessEnabled && protocol == 3 {
452458
hitlessHandshakeErr = conn.ClientMaintNotifications(
453459
ctx,
454460
true,
455-
c.opt.HitlessUpgradeConfig.EndpointType.String(),
461+
endpointType.String(),
456462
).Err()
457463
if hitlessHandshakeErr != nil {
458464
c.optLock.RLock()

0 commit comments

Comments
 (0)