1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

feat: add VoidPushNotificationProcessor for disabled push notifications

- Add VoidPushNotificationProcessor that reads and discards push notifications
- Create PushNotificationProcessorInterface for consistent behavior
- Always provide a processor (real or void) instead of nil
- VoidPushNotificationProcessor properly cleans RESP3 push notifications from buffer
- Remove all nil checks throughout codebase for cleaner, safer code
- Update tests to expect VoidPushNotificationProcessor when disabled

Benefits:
- Eliminates nil pointer risks throughout the codebase
- Follows null object pattern for safer operation
- Properly handles RESP3 push notifications even when disabled
- Consistent interface regardless of push notification settings
- Cleaner code without defensive nil checks everywhere
This commit is contained in:
Nedyalko Dyakov
2025-06-27 01:04:31 +03:00
parent c33b157015
commit fdfcf94300
6 changed files with 109 additions and 41 deletions

View File

@ -230,7 +230,7 @@ type Options struct {
// PushNotificationProcessor is the processor for handling push notifications.
// If nil, a default processor will be created when PushNotifications is enabled.
PushNotificationProcessor *PushNotificationProcessor
PushNotificationProcessor PushNotificationProcessorInterface
}
func (opt *Options) init() {