mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-03 17:59:29 +02:00
Increase maxRetriesPerRequest for Redis connections to improve resilience
This commit is contained in:
@@ -158,7 +158,7 @@ class RedisManager {
|
|||||||
this.writeClient = new Redis({
|
this.writeClient = new Redis({
|
||||||
...masterConfig,
|
...masterConfig,
|
||||||
enableReadyCheck: false,
|
enableReadyCheck: false,
|
||||||
maxRetriesPerRequest: 3,
|
maxRetriesPerRequest: 50,
|
||||||
keepAlive: 30000,
|
keepAlive: 30000,
|
||||||
connectTimeout: this.connectionTimeout,
|
connectTimeout: this.connectionTimeout,
|
||||||
commandTimeout: this.commandTimeout
|
commandTimeout: this.commandTimeout
|
||||||
@@ -169,7 +169,7 @@ class RedisManager {
|
|||||||
this.readClient = new Redis({
|
this.readClient = new Redis({
|
||||||
...replicaConfig!,
|
...replicaConfig!,
|
||||||
enableReadyCheck: false,
|
enableReadyCheck: false,
|
||||||
maxRetriesPerRequest: 3,
|
maxRetriesPerRequest: 50,
|
||||||
keepAlive: 30000,
|
keepAlive: 30000,
|
||||||
connectTimeout: this.connectionTimeout,
|
connectTimeout: this.connectionTimeout,
|
||||||
commandTimeout: this.commandTimeout
|
commandTimeout: this.commandTimeout
|
||||||
@@ -186,7 +186,7 @@ class RedisManager {
|
|||||||
this.publisher = new Redis({
|
this.publisher = new Redis({
|
||||||
...masterConfig,
|
...masterConfig,
|
||||||
enableReadyCheck: false,
|
enableReadyCheck: false,
|
||||||
maxRetriesPerRequest: 3,
|
maxRetriesPerRequest: 50,
|
||||||
keepAlive: 30000,
|
keepAlive: 30000,
|
||||||
connectTimeout: this.connectionTimeout,
|
connectTimeout: this.connectionTimeout,
|
||||||
commandTimeout: this.commandTimeout
|
commandTimeout: this.commandTimeout
|
||||||
@@ -196,7 +196,7 @@ class RedisManager {
|
|||||||
this.subscriber = new Redis({
|
this.subscriber = new Redis({
|
||||||
...(this.hasReplicas ? replicaConfig! : masterConfig),
|
...(this.hasReplicas ? replicaConfig! : masterConfig),
|
||||||
enableReadyCheck: false,
|
enableReadyCheck: false,
|
||||||
maxRetriesPerRequest: 3,
|
maxRetriesPerRequest: 50,
|
||||||
keepAlive: 30000,
|
keepAlive: 30000,
|
||||||
connectTimeout: this.connectionTimeout,
|
connectTimeout: this.connectionTimeout,
|
||||||
commandTimeout: this.commandTimeout
|
commandTimeout: this.commandTimeout
|
||||||
@@ -901,7 +901,9 @@ class RegionalRedisManager {
|
|||||||
// if the configured host doesn't match that pattern (e.g. local dev),
|
// if the configured host doesn't match that pattern (e.g. local dev),
|
||||||
// in which case callers should fall back to the primary for reads.
|
// in which case callers should fall back to the primary for reads.
|
||||||
private getReplicaHost(primaryHost: string): string | null {
|
private getReplicaHost(primaryHost: string): string | null {
|
||||||
const match = primaryHost.match(/^redis\.([^.]+)\.svc\.cluster\.local$/);
|
const match = primaryHost.match(
|
||||||
|
/^redis\.([^.]+)\.svc\.cluster\.local$/
|
||||||
|
);
|
||||||
if (!match) return null;
|
if (!match) return null;
|
||||||
const namespace = match[1];
|
const namespace = match[1];
|
||||||
return `redis-1.redis-headless.${namespace}.svc.cluster.local`;
|
return `redis-1.redis-headless.${namespace}.svc.cluster.local`;
|
||||||
@@ -912,7 +914,7 @@ class RegionalRedisManager {
|
|||||||
const baseOpts = {
|
const baseOpts = {
|
||||||
...cfg,
|
...cfg,
|
||||||
enableReadyCheck: false,
|
enableReadyCheck: false,
|
||||||
maxRetriesPerRequest: 3,
|
maxRetriesPerRequest: 50,
|
||||||
keepAlive: 10000,
|
keepAlive: 10000,
|
||||||
connectTimeout: this.connectionTimeout,
|
connectTimeout: this.connectionTimeout,
|
||||||
commandTimeout: this.commandTimeout
|
commandTimeout: this.commandTimeout
|
||||||
|
|||||||
Reference in New Issue
Block a user