redisForJobQueue の接続を使い回す (MisskeyIO#268)
This commit is contained in:
parent
107cd9788e
commit
7122657f13
6 changed files with 54 additions and 33 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { Config } from '@/config.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
import type * as Redis from 'ioredis';
|
||||
|
||||
export const QUEUE = {
|
||||
DELIVER: 'deliver',
|
||||
|
@ -17,12 +18,9 @@ export const QUEUE = {
|
|||
WEBHOOK_DELIVER: 'webhookDeliver',
|
||||
};
|
||||
|
||||
export function baseQueueOptions(config: Config, queueName: typeof QUEUE[keyof typeof QUEUE]): Bull.QueueOptions {
|
||||
export function baseQueueOptions(config: Config, queueName: typeof QUEUE[keyof typeof QUEUE], redisConnection: Redis.Redis): Bull.QueueOptions {
|
||||
return {
|
||||
connection: {
|
||||
...config.redisForJobQueue,
|
||||
keyPrefix: undefined,
|
||||
},
|
||||
connection: redisConnection,
|
||||
prefix: config.redisForJobQueue.prefix ? `${config.redisForJobQueue.prefix}:queue:${queueName}` : `queue:${queueName}`,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue