1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-18 00:20:57 +03:00

feat: fix connection health check interference with push notifications

- Add PushNotificationProcessor field to pool.Conn for connection-level processing
- Modify connection pool Put() and isHealthyConn() to handle push notifications
- Process pending push notifications before discarding connections
- Pass push notification processor to connections during creation
- Update connection pool options to include push notification processor
- Add comprehensive test for connection health check integration

This prevents connections with buffered push notification data from being
incorrectly discarded by the connection health check, ensuring push
notifications are properly processed and connections are reused.
This commit is contained in:
Nedyalko Dyakov
2025-06-26 21:22:59 +03:00
parent e6e2cead66
commit d7fbe18214
5 changed files with 117 additions and 6 deletions

View File

@ -767,11 +767,17 @@ func NewClient(opt *Options) *Client {
},
}
c.init()
c.connPool = newConnPool(opt, c.dialHook)
// Initialize push notification processor
c.initializePushProcessor()
// Update options with the initialized push processor for connection pool
if c.pushProcessor != nil {
opt.PushNotificationProcessor = c.pushProcessor
}
c.connPool = newConnPool(opt, c.dialHook)
return &c
}