-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Streaming: Improve Redis connection options handling #31623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streaming: Improve Redis connection options handling #31623
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
6985dfa
to
e6bb1e4
Compare
Turns out ioredis doesn't support |
e6bb1e4
to
c20441d
Compare
Do we really want to switch to |
Having read up on this a bit, I fear that |
Having looked at all of the changes in more detail now, I kind of agree with Claire. I wonder if a small utility function (maybe So something like: function prefixedName(name) {
return `${redisNamespace}${name}`;
}
// and then later
redisClient.set(prefixedName(`subscribed:${channel}`));
// and
redisSubscribeClient.subscribe(prefixedName(channell)); |
@ClearlyClaire I think yes, because it reduces the number of places we manually prefix to just two, making the code more maintainable imo |
I knew there was a reason why we didn't just use |
Have revised the namespacing to not use keyPrefix and instead have two helper methods. |
I do not think giving both Also, I see no need for it. If you want to specify the password separately, simply use the separate environment variables. If you want to give the full configuration in a single variable, use I think the same reasoning applies to redis. |
I just approved these changes. I am currently working on adding sentinel support to the ruby side. We should wait with merging this until both PRs are ready and then merge them together. |
@oneiros let me know if you need any changes here as you develop out the ruby side of things |
The ruby part is ready (well, for review that is) here #31744 I combined both PRs and created a small test setup (3 redis instances, 3 sentinels) locally and everything (inlcuding failover) worked perfectly. |
This does the following:
keyPrefix
which appears to work correctly in ioredis, since we don't use KEYS or SCAN commands. Note: we still need to manually prefixsubscribe
andunsubscribe
commands.REDIS_URL
over all otherREDIS_*
options. This does mean that we don't merge those options withREDIS_URL
, which is the expected behavior from the Ruby side. Fixes Inconsistent handling of REDIS environment variables across streaming and puma images #29770REDIS_SENTINELS
REDIS_SENTINEL_MASTER
REDIS_SENTINEL_PORT
REDIS_SENTINEL_USERNAME
(defaults toREDIS_USERNAME
)REDIS_SENTINEL_PASSWORD
(defaults toREDIS_PASSWORD
)We may also want to consider a method here for setting TLS options.