mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
fix(push): address comments
This commit is contained in:
@ -232,7 +232,6 @@ func (p *ConnPool) dialConn(ctx context.Context, pooled bool) (*Conn, error) {
|
|||||||
|
|
||||||
cn := NewConn(netConn)
|
cn := NewConn(netConn)
|
||||||
cn.pooled = pooled
|
cn.pooled = pooled
|
||||||
|
|
||||||
return cn, nil
|
return cn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,18 +140,3 @@ func IsVoidProcessorError(err error) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractNotificationName attempts to extract the notification name from error messages
|
|
||||||
func extractNotificationName(err error) string {
|
|
||||||
if handlerErr, ok := err.(*HandlerError); ok {
|
|
||||||
if handlerErr.PushNotificationName != "" {
|
|
||||||
return handlerErr.PushNotificationName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if procErr, ok := err.(*ProcessorError); ok {
|
|
||||||
if procErr.PushNotificationName != "" {
|
|
||||||
return procErr.PushNotificationName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "unknown"
|
|
||||||
}
|
|
||||||
|
4
redis.go
4
redis.go
@ -1103,7 +1103,9 @@ func (c *baseClient) processPushNotifications(ctx context.Context, cn *pool.Conn
|
|||||||
// Use WithReader to access the reader and process push notifications
|
// Use WithReader to access the reader and process push notifications
|
||||||
// This is critical for hitless upgrades to work properly
|
// This is critical for hitless upgrades to work properly
|
||||||
// NOTE: almost no timeouts are set for this read, so it should not block
|
// NOTE: almost no timeouts are set for this read, so it should not block
|
||||||
return cn.WithReader(ctx, 1, func(rd *proto.Reader) error {
|
// longer than necessary, 50us should be plenty of time to read if there are any push notifications
|
||||||
|
// on the socket
|
||||||
|
return cn.WithReader(ctx, 50*time.Microsecond, func(rd *proto.Reader) error {
|
||||||
// Create handler context with client, connection pool, and connection information
|
// Create handler context with client, connection pool, and connection information
|
||||||
handlerCtx := c.pushNotificationHandlerContext(cn)
|
handlerCtx := c.pushNotificationHandlerContext(cn)
|
||||||
return c.pushProcessor.ProcessPendingNotifications(ctx, handlerCtx, rd)
|
return c.pushProcessor.ProcessPendingNotifications(ctx, handlerCtx, rd)
|
||||||
|
Reference in New Issue
Block a user