enhance(Queue): ジョブキューの設定の項目をキューごとに分ける (MisskeyIO#301)
This commit is contained in:
parent
9ade4bc326
commit
3dd8c675d9
5 changed files with 49 additions and 25 deletions
|
@ -3,8 +3,9 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Config } from '@/config.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
import type { RedisOptions } from "ioredis";
|
||||
import type { RedisOptionsSource } from '@/config.js';
|
||||
|
||||
export const QUEUE = {
|
||||
DELIVER: 'deliver',
|
||||
|
@ -17,13 +18,13 @@ export const QUEUE = {
|
|||
WEBHOOK_DELIVER: 'webhookDeliver',
|
||||
};
|
||||
|
||||
export function baseQueueOptions(config: Config, queueName: typeof QUEUE[keyof typeof QUEUE]): Bull.QueueOptions {
|
||||
export function baseQueueOptions(config: RedisOptions & RedisOptionsSource, queueName: typeof QUEUE[keyof typeof QUEUE]): Bull.QueueOptions {
|
||||
return {
|
||||
connection: {
|
||||
...config.redisForJobQueue,
|
||||
...config,
|
||||
maxRetriesPerRequest: null,
|
||||
keyPrefix: undefined,
|
||||
},
|
||||
prefix: config.redisForJobQueue.prefix ? `${config.redisForJobQueue.prefix}:queue:${queueName}` : `queue:${queueName}`,
|
||||
prefix: config.prefix ? `${config.prefix}:queue:${queueName}` : `queue:${queueName}`,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue