BullMQ's Production Checklist advises that Queue operations should fail fast while Worker operations should be long running and be tolerant to errors/failures.
So ideally we would create 2 connections in config/redis.ts:
import { defineConfig } from '@adonisjs/redis'
const redisConfig = defineConfig({
queue: {
host: env.get('REDIS_HOST'),
port: env.get('REDIS_PORT'),
password: env.get('REDIS_PASSWORD'),
db: 0,
retryStrategy(times) {
return Math.min(times * 1000, 20000) // 1s min, 20s max
},
maxRetriesPerRequest: 3,
enableReadyCheck: true,
enableOfflineQueue: false,
},
worker: {
host: env.get('REDIS_HOST'),
port: env.get('REDIS_PORT'),
password: env.get('REDIS_PASSWORD'),
db: 0,
retryStrategy(times) {
return Math.min(times * 1000, 20000) // 1s min, 20s max
},
maxRetriesPerRequest: null, // See https://docs.bullmq.io/guide/going-to-production#maxretriesperrequest
enableReadyCheck: true,
enableOfflineQueue: true,
},
}
export default redisConfig
declare module '@adonisjs/redis/types' {
export interface RedisConnections extends InferConnections<typeof redisConfig> {}
}
and then in config/queue.ts:
import { defineConfig } from '@nemoventures/adonis-jobs'
const queueConfig = defineConfig({
connection: {
queueConnectionName: 'queue',
workerConnectionName: 'worker',
},
useSharedConnection: true,
}
export default queueConfig

BullMQ's Production Checklist advises that Queue operations should fail fast while Worker operations should be long running and be tolerant to errors/failures.
So ideally we would create 2 connections in
config/redis.ts:and then in
config/queue.ts: