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

54 Commits

Author SHA1 Message Date
b6e712b41a feat: add proactive push notification processing to WithReader
- Add push notification processing to Conn.WithReader method
- Process notifications immediately before every read operation
- Provides proactive notification handling vs reactive processing
- Add proper error handling with internal.Logger
- Non-blocking implementation that doesn't break Redis operations
- Complements existing processing in Pool.Put and isHealthyConn

Benefits:
- Immediate processing when notifications arrive
- Called before every read operation for optimal timing
- Prevents notification backlog accumulation
- More responsive to Redis cluster changes
- Better user experience during migrations
- Optimal placement for catching asynchronous notifications

Implementation:
- Type-safe interface assertion for processor
- Context-aware error handling with logging
- Maintains backward compatibility
- Consistent with existing pool patterns
- Three-layer processing strategy: WithReader (proactive) + Pool.Put + isHealthyConn (reactive)

Use cases:
- MOVING/MIGRATING/MIGRATED notifications for slot migrations
- FAILING_OVER/FAILED_OVER notifications for failover scenarios
- Real-time cluster topology change awareness
- Improved connection utilization efficiency
2025-06-27 22:56:04 +03:00
3473c1e998 fix: simplify api 2025-06-27 22:27:32 +03:00
f7948b5c5c fix: address pr review 2025-06-27 18:26:15 +03:00
be9b6dd6a0 refactor: remove unnecessary enabled field and IsEnabled/SetEnabled methods
- Remove enabled field from PushNotificationProcessor struct
- Remove IsEnabled() and SetEnabled() methods from processor interface
- Remove enabled parameter from NewPushNotificationProcessor()
- Update all interfaces in pool package to remove IsEnabled requirement
- Simplify processor logic - if processor exists, it works
- VoidPushNotificationProcessor handles disabled case by discarding notifications
- Update all tests to use simplified interface without enable/disable logic

Benefits:
- Simpler, cleaner interface with less complexity
- No unnecessary state management for enabled/disabled
- VoidPushNotificationProcessor pattern handles disabled case elegantly
- Reduced cognitive overhead - processors just work when set
- Eliminates redundant enabled checks throughout codebase
- More predictable behavior - set processor = it works
2025-06-27 01:36:38 +03:00
d7fbe18214 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.
2025-06-27 01:36:20 +03:00
86d418f940 feat: Introducing StreamingCredentialsProvider for token based authentication (#3320)
* wip

* update documentation

* add streamingcredentialsprovider in options

* fix: put back option in pool creation

* add package level comment

* Initial re authentication implementation

Introduces the StreamingCredentialsProvider as the CredentialsProvider
with the highest priority.

TODO: needs to be tested

* Change function type name

Change CancelProviderFunc to UnsubscribeFunc

* add tests

* fix race in tests

* fix example tests

* wip, hooks refactor

* fix build

* update README.md

* update wordlist

* update README.md

* refactor(auth): early returns in cred listener

* fix(doctest): simulate some delay

* feat(conn): add close hook on conn

* fix(tests): simulate start/stop in mock credentials provider

* fix(auth): don't double close the conn

* docs(README): mark streaming credentials provider as experimental

* fix(auth): streamline auth err proccess

* fix(auth): check err on close conn

* chore(entraid): use the repo under redis org
2025-05-27 16:25:20 +03:00
97b491aace chore: update import path 2023-01-23 08:48:54 +02:00
58f7149e38 feat: add ContextTimeoutEnabled to respect context timeouts and deadlines 2022-10-11 10:22:42 +03:00
bac50ce2e9 chore: allow to disable timeouts 2022-10-05 10:36:12 +03:00
2123e08437 fix(internal/pool): call SetDeadline even if timeout is zero 2022-08-04 11:22:11 +08:00
a18fad5bd3 chore: v9 2022-06-04 17:42:06 +03:00
3961b9577f fix: use redis over ssh channel(#2057) (#2060) 2022-03-26 18:11:44 +08:00
27e2efb0af Remove OpenTelemetry metrics for now (#1805) 2021-06-30 18:40:23 +08:00
6e4eb2e3ac Remove OpenTelemetry from the code (but leave redisotel as is) (#1782) 2021-06-03 19:01:51 +08:00
1b77706c0c Optimize Otel instrumentation 2021-03-20 10:01:48 +02:00
3921cd497c Update to otel v0.14 2020-11-21 09:56:52 +02:00
13782c03d0 Tweak otel span and attr names 2020-11-15 14:30:27 +02:00
566840fe27 otel: add RemoteAddr 2020-09-28 17:35:49 +03:00
62469e4f42 Introduce metrics capture with OpenTelemetry (#1398)
* internal: Add instrumentation

Co-authored-by: reggiemcdonald <regmcdonald95@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-15 12:07:07 +03:00
1831363467 Add RecordError 2020-07-09 10:39:46 +03:00
8eed1e67ff Add OpenTelemetryHook 2020-06-09 17:17:41 +03:00
3dcb844106 Bump major version 2020-05-19 08:52:38 +03:00
f5593121e0 Add ctx as first arg 2020-05-19 08:52:38 +03:00
eaeb8f2a08 internal: return an error on setting deadline 2019-08-16 17:50:57 +03:00
7779accbea Use semantic import versioning 2019-08-08 14:29:44 +03:00
880e05d975 Cleanup 2019-06-14 16:00:03 +03:00
c0e70ad31d internal/pool: use min nonzero deadline 2019-06-14 14:50:58 +03:00
f8704e4b6b Cleanup 2019-06-09 12:29:23 +03:00
5460bc10f2 Use Context.Deadline to set net.Conn deadline 2019-06-08 15:02:51 +03:00
6c72dc807e internal/pool: replace atomic.Value with int64 2019-06-01 11:32:05 +03:00
b706478fdc Fix MinIdleConns and MaxConnAge 2019-03-25 13:02:31 +02:00
0197108027 Use bufio.Writer 2018-08-17 14:14:02 +03:00
5146fb0c57 Cleanup buffers manipulation 2018-08-15 11:53:15 +03:00
7c26d1ceb6 Pass cn.Rd where possible 2018-08-15 09:38:58 +03:00
cfe305296f Bench bigget values 2018-08-15 09:10:53 +03:00
651e9fef1d Add MaxConnAge 2018-08-12 10:25:16 +03:00
25bf3e79e5 Add MinIdleConns 2018-08-12 08:34:06 +03:00
96d1b85009 Cleanups 2018-08-06 13:59:15 +03:00
464daeb271 Rename BufioReader to ElasticBufReader 2018-08-06 13:37:20 +03:00
b576fe91a1 Use single read and write buffer where possible 2018-08-04 13:09:22 +03:00
7c9aa65a40 Cleanup 2018-07-22 09:27:36 +03:00
8040d63c4f Remove gopkg.in 2017-02-19 09:49:21 +02:00
6b6f5ca133 Separate read and write buffers for PubSub. 2017-02-19 09:42:45 +02:00
ce4fd8b677 Fix ReceiveMessage to work without any subscriptions. 2017-02-08 14:15:32 +02:00
b4efc45f1c Set read/write timeouts more consistently. 2016-12-03 17:30:13 +02:00
f5245efa73 Prepare v5 release. 2016-10-09 10:56:53 +00:00
7d856c5595 Make proto/parser an internal package 2016-07-02 13:52:10 +01:00
6e1aef39ea Faster and simpler pool. 2016-03-19 11:49:13 +02:00
f47fb47df0 Extract race tests to separate file. Add more race tests. 2016-03-16 19:45:35 +02:00
707472c09b Fix connection initialization. 2016-03-15 14:21:53 +02:00