Skip to content

Commit

Permalink
READONLYやタイムアウトの場合リトライするように、それ以外のエラーはreconnectするように
Browse files Browse the repository at this point in the history
  • Loading branch information
u1-liquid committed Jan 2, 2024
1 parent 9de26a4 commit 7d8348b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/backend/src/queue/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export function baseQueueOptions(config: RedisOptions & RedisOptionsSource, queu
...config,
maxRetriesPerRequest: null,
keyPrefix: undefined,
reconnectOnError: (err: Error) => {
if ( err.message.includes('READONLY')
|| err.message.includes('ETIMEDOUT')
|| err.message.includes('Command timed out')
) return 2;
return 1;
}
},
prefix: config.prefix ? `${config.prefix}:queue:${queueName}` : `queue:${queueName}`,
};
Expand All @@ -37,6 +44,13 @@ export function baseWorkerOptions(config: RedisOptions & RedisOptionsSource, wor
...config,
maxRetriesPerRequest: null,
keyPrefix: undefined,
reconnectOnError: (err: Error) => {
if ( err.message.includes('READONLY')
|| err.message.includes('ETIMEDOUT')
|| err.message.includes('Command timed out')
) return 2;
return 1;
}
},
prefix: config.prefix ? `${config.prefix}:queue:${queueName}` : `queue:${queueName}`,
};
Expand Down

0 comments on commit 7d8348b

Please sign in to comment.