mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 17:24:12 +00:00
fix(queue): resolve queue-worker crash-loop via Redis auth and PM2 config
Redis requires authentication but IORedis connections were not passing a password, causing immediate NOAUTH failures and a PM2 crash-loop (1900+ restarts). Additionally, the PM2 config used `npx` as the script entry which caused instability. - Add REDIS_PASSWORD support to queue-service.ts and redis.ts - Change PM2 script from npx wrapper to direct tsx CLI entry point - Add explicit exec_mode: 'fork' to prevent cluster mode issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ed07e15670
commit
e904f0949b
3 changed files with 5 additions and 2 deletions
|
|
@ -25,8 +25,9 @@ module.exports = {
|
|||
{
|
||||
name: 'queue-worker',
|
||||
cwd: '/home/payload/payload-cms',
|
||||
script: 'npx',
|
||||
args: 'tsx scripts/run-queue-worker.ts',
|
||||
script: 'node_modules/tsx/dist/cli.mjs',
|
||||
args: 'scripts/run-queue-worker.ts',
|
||||
exec_mode: 'fork',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
// Credentials werden via dotenv aus .env geladen (siehe run-queue-worker.ts)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ export function getQueueRedisConnection(): IORedis {
|
|||
host,
|
||||
port,
|
||||
db: QUEUE_REDIS_DB,
|
||||
password: process.env.REDIS_PASSWORD || undefined,
|
||||
maxRetriesPerRequest: null, // BullMQ requirement
|
||||
enableReadyCheck: false,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ function createRedisClient(): Redis {
|
|||
host: REDIS_HOST,
|
||||
port: REDIS_PORT,
|
||||
db: REDIS_DB,
|
||||
password: process.env.REDIS_PASSWORD || undefined,
|
||||
maxRetriesPerRequest: 3,
|
||||
retryStrategy: (times) => {
|
||||
if (times > 3) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue