Drop redis namespace code (except for Rails cache) (#34665)

This commit is contained in:
Claire 2025-05-20 15:02:09 +02:00 committed by GitHub
parent f94b1fce41
commit 6d6263ce07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 66 deletions

View file

@ -4,7 +4,6 @@ import { parseIntFromEnvValue } from './utils.js';
/**
* @typedef RedisConfiguration
* @property {string|undefined} namespace
* @property {string|undefined} url
* @property {import('ioredis').RedisOptions} options
*/
@ -64,8 +63,6 @@ function getSentinelConfiguration(env, commonOptions) {
* @returns {RedisConfiguration} configuration for the Redis connection
*/
export function configFromEnv(env) {
const redisNamespace = env.REDIS_NAMESPACE;
// These options apply for both REDIS_URL based connections and connections
// using the other REDIS_* environment variables:
const commonOptions = {
@ -82,16 +79,14 @@ export function configFromEnv(env) {
if (typeof env.REDIS_URL === 'string' && env.REDIS_URL.length > 0) {
return {
url: env.REDIS_URL,
options: commonOptions,
namespace: redisNamespace
options: commonOptions
};
}
// If we have configuration for Redis Sentinel mode, prefer that:
if (hasSentinelConfiguration(env)) {
return {
options: getSentinelConfiguration(env, commonOptions),
namespace: redisNamespace
options: getSentinelConfiguration(env, commonOptions)
};
}
@ -110,8 +105,7 @@ export function configFromEnv(env) {
};
return {
options,
namespace: redisNamespace
options
};
}