MCPcopy
hub / github.com/redis/go-redis / initializePushProcessor

Function initializePushProcessor

redis.go:1474–1488  ·  view source on GitHub ↗

initializePushProcessor initializes the push notification processor for any client type. This is a shared helper to avoid duplication across NewClient, NewFailoverClient, and NewSentinelClient.

(opt *Options)

Source from the content-addressed store, hash-verified

1472// initializePushProcessor initializes the push notification processor for any client type.
1473// This is a shared helper to avoid duplication across NewClient, NewFailoverClient, and NewSentinelClient.
1474func initializePushProcessor(opt *Options) push.NotificationProcessor {
1475 // Always use custom processor if provided
1476 if opt.PushNotificationProcessor != nil {
1477 return opt.PushNotificationProcessor
1478 }
1479
1480 // Push notifications are always enabled for RESP3, disabled for RESP2
1481 if opt.Protocol == 3 {
1482 // Create default processor for RESP3 connections
1483 return NewPushNotificationProcessor()
1484 }
1485
1486 // Create void processor for RESP2 connections (push notifications not available)
1487 return NewVoidPushNotificationProcessor()
1488}
1489
1490// RegisterPushNotificationHandler registers a handler for a specific push notification name.
1491// Returns an error if a handler is already registered for this push notification name.

Callers 3

NewClientFunction · 0.85
newConnFunction · 0.85
NewFailoverClientFunction · 0.85

Tested by

no test coverage detected