diff --git a/.config/docker_example.yml b/.config/docker_example.yml index 13ecfac549f1119e52e78586c83be00f477aeac0..d93cc8b70e9a95441b406d8ef727dd04baac3a0d 100644 --- a/.config/docker_example.yml +++ b/.config/docker_example.yml @@ -70,6 +70,14 @@ redis: # #prefix: example-prefix # #db: 1 +#redisForJobQueue: +# host: redis +# port: 6379 +# #family: 0 # 0=Both, 4=IPv4, 6=IPv6 +# #pass: example-pass +# #prefix: example-prefix +# #db: 1 + # ┌─────────────────────────────┠#───┘ Elasticsearch configuration └───────────────────────────── diff --git a/.config/example.yml b/.config/example.yml index fbdb7b0241c8aad5b8c5522cc6036ed8ee193300..b61ed14809f6e2e61640ace2a1a400b77f2f9da9 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -70,6 +70,14 @@ redis: # #prefix: example-prefix # #db: 1 +#redisForJobQueue: +# host: localhost +# port: 6379 +# #family: 0 # 0=Both, 4=IPv4, 6=IPv6 +# #pass: example-pass +# #prefix: example-prefix +# #db: 1 + # ┌─────────────────────────────┠#───┘ Elasticsearch configuration └───────────────────────────── diff --git a/.devcontainer/devcontainer.yml b/.devcontainer/devcontainer.yml index 4cc7ae3b59c2ca27068d1da1c37f32ccf229cdc7..1350e70157a886ec5b52a7e5582e2445f27f68f7 100644 --- a/.devcontainer/devcontainer.yml +++ b/.devcontainer/devcontainer.yml @@ -70,6 +70,14 @@ redis: # #prefix: example-prefix # #db: 1 +#redisForJobQueue: +# host: redis +# port: 6379 +# #family: 0 # 0=Both, 4=IPv4, 6=IPv6 +# #pass: example-pass +# #prefix: example-prefix +# #db: 1 + # ┌─────────────────────────────┠#───┘ Elasticsearch configuration └───────────────────────────── diff --git a/CHANGELOG.md b/CHANGELOG.md index 28be3faff972c33a60c799cf7b7c79a29164e21b..03cf179a8604ed46e9c91fe602590d33043ab6a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ ### Server - イベント用Redisを別サーãƒãƒ¼ã«åˆ†é›¢ã§ãるよã†ã« +- ジョブã‚ュー用Redisを別サーãƒãƒ¼ã«åˆ†é›¢ã§ãるよã†ã« - サーãƒãƒ¼ã®å…¨ä½“çš„ãªãƒ‘フォーマンスをå‘上 - ノート作æˆæ™‚ã®ãƒ‘フォーマンスをå‘上 - アンテナã®ã‚¿ã‚¤ãƒ ラインå–得時ã®ãƒ‘フォーマンスをå‘上 diff --git a/chart/files/default.yml b/chart/files/default.yml index afaf8a162d1734f7fb81dc63661f3f48ac397214..1d8e5b490ab4f5bb576fff6579e9afe1dd9112ee 100644 --- a/chart/files/default.yml +++ b/chart/files/default.yml @@ -91,6 +91,14 @@ redis: # #prefix: example-prefix # #db: 1 +#redisForJobQueue: +# host: localhost +# port: 6379 +# #family: 0 # 0=Both, 4=IPv4, 6=IPv6 +# #pass: example-pass +# #prefix: example-prefix +# #db: 1 + # ┌─────────────────────────────┠#───┘ Elasticsearch configuration └───────────────────────────── diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts index e8554e5c846b753f6774dfb648ce56b05824c1b4..fd2b83cf2a3994eea915994f753c33d98aa57f14 100644 --- a/packages/backend/src/config.ts +++ b/packages/backend/src/config.ts @@ -41,6 +41,14 @@ export type Source = { db?: number; prefix?: string; }; + redisForJobQueue?: { + host: string; + port: number; + family?: number; + pass: string; + db?: number; + prefix?: string; + }; elasticsearch: { host: string; port: number; @@ -99,6 +107,8 @@ export type Mixin = { mediaProxy: string; externalMediaProxyEnabled: boolean; videoThumbnailGenerator: string | null; + redisForPubsub: NonNullable<Source['redisForPubsub']>; + redisForJobQueue: NonNullable<Source['redisForJobQueue']>; }; export type Config = Source & Mixin; @@ -160,6 +170,7 @@ export function loadConfig() { if (!config.redis.prefix) config.redis.prefix = mixin.host; if (config.redisForPubsub == null) config.redisForPubsub = config.redis; + if (config.redisForJobQueue == null) config.redisForJobQueue = config.redis; return Object.assign(config, mixin); } diff --git a/packages/backend/src/core/QueueModule.ts b/packages/backend/src/core/QueueModule.ts index edd843977b6614cbe1440cab0db26ed42d29d82c..8733a7d7eb73701ebdc9b05bb1018d99a145654f 100644 --- a/packages/backend/src/core/QueueModule.ts +++ b/packages/backend/src/core/QueueModule.ts @@ -8,13 +8,13 @@ import type { DeliverJobData, InboxJobData, DbJobData, ObjectStorageJobData, End function q<T>(config: Config, name: string, limitPerSec = -1) { return new Bull<T>(name, { redis: { - port: config.redis.port, - host: config.redis.host, - family: config.redis.family == null ? 0 : config.redis.family, - password: config.redis.pass, - db: config.redis.db ?? 0, + port: config.redisForJobQueue.port, + host: config.redisForJobQueue.host, + family: config.redisForJobQueue.family == null ? 0 : config.redisForJobQueue.family, + password: config.redisForJobQueue.pass, + db: config.redisForJobQueue.db ?? 0, }, - prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : 'queue', + prefix: config.redisForJobQueue.prefix ? `${config.redisForJobQueue.prefix}:queue` : 'queue', limiter: limitPerSec > 0 ? { max: limitPerSec, duration: 1000,