2023-07-27 05:31:52 +00:00
|
|
|
/*
|
2024-02-13 15:50:11 +00:00
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
2023-07-27 05:31:52 +00:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-05-29 02:54:49 +00:00
|
|
|
import { Config } from '@/config.js';
|
|
|
|
import type * as Bull from 'bullmq';
|
|
|
|
|
|
|
|
export const QUEUE = {
|
|
|
|
DELIVER: 'deliver',
|
|
|
|
INBOX: 'inbox',
|
|
|
|
SYSTEM: 'system',
|
|
|
|
ENDED_POLL_NOTIFICATION: 'endedPollNotification',
|
|
|
|
DB: 'db',
|
|
|
|
RELATIONSHIP: 'relationship',
|
|
|
|
OBJECT_STORAGE: 'objectStorage',
|
|
|
|
WEBHOOK_DELIVER: 'webhookDeliver',
|
|
|
|
};
|
|
|
|
|
|
|
|
export function baseQueueOptions(config: Config, queueName: typeof QUEUE[keyof typeof QUEUE]): Bull.QueueOptions {
|
|
|
|
return {
|
|
|
|
connection: {
|
2023-07-20 10:50:31 +00:00
|
|
|
...config.redisForJobQueue,
|
2023-07-27 05:31:52 +00:00
|
|
|
keyPrefix: undefined,
|
2023-05-29 02:54:49 +00:00
|
|
|
},
|
|
|
|
prefix: config.redisForJobQueue.prefix ? `${config.redisForJobQueue.prefix}:queue:${queueName}` : `queue:${queueName}`,
|
|
|
|
};
|
|
|
|
}
|