Files
speckle-server/packages/server/modules/shared/helpers/bullHelper.ts
T
2022-08-19 10:27:48 +03:00

21 lines
548 B
TypeScript

import Redis from 'ioredis'
import Bull from 'bull'
import { getRedisUrl } from '@/modules/shared/helpers/envHelper'
export function buildBaseQueueOptions(): Bull.QueueOptions {
return {
createClient: (type) => {
// @see https://github.com/OptimalBits/bull/issues/1873
const client = new Redis(getRedisUrl(), {
...(['bclient', 'subscriber'].includes(type)
? {
enableReadyCheck: false,
maxRetriesPerRequest: null
}
: {})
})
return client
}
}
}