Skip to content

Commit 31fae89

Browse files
committed
fix for empty endpoint
1 parent 4ec6958 commit 31fae89

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

maintnotifications/push_notification_handler.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,20 @@ func (snh *NotificationHandler) handleMoving(ctx context.Context, handlerCtx pus
147147
if err := snh.markConnForHandoff(poolConn, newEndpoint, seqID, deadline); err != nil {
148148
// Log error but don't fail the goroutine - use background context since original may be cancelled
149149
internal.Logger.Printf(context.Background(), logs.FailedToMarkForHandoff(poolConn.GetID(), err))
150+
return
151+
}
152+
153+
// Queue the handoff immediately if the connection is idle in the pool.
154+
// If the connection is in use (StateInUse), it will be queued when returned to the pool via OnPut.
155+
// This handles the case where the connection is idle and might never be retrieved again.
156+
if poolConn.GetStateMachine().GetState() == pool.StateIdle {
157+
if snh.manager.poolHooksRef != nil && snh.manager.poolHooksRef.workerManager != nil {
158+
if err := snh.manager.poolHooksRef.workerManager.queueHandoff(poolConn); err != nil {
159+
internal.Logger.Printf(context.Background(), logs.FailedToQueueHandoff(poolConn.GetID(), err))
160+
}
161+
}
150162
}
163+
// If connection is StateInUse, the handoff will be queued when it's returned to the pool
151164
})
152165
return nil
153166
}

0 commit comments

Comments
 (0)