14 lines
477 B
TypeScript
14 lines
477 B
TypeScript
import type { RedisConfig } from './types';
|
|
|
|
/** Honor the explicit endpoint, including isolated test Redis instances. */
|
|
export function getRedisConnection(config: RedisConfig) {
|
|
return {
|
|
...config,
|
|
maxRetriesPerRequest: null, // Workers must survive transient outages.
|
|
enableReadyCheck: false,
|
|
connectTimeout: 3000,
|
|
lazyConnect: false,
|
|
keepAlive: 10000,
|
|
retryStrategy: (times: number) => config.retryDelay ?? Math.min(times * 100, 3000),
|
|
};
|
|
}
|