mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-24 00:39:32 +09:00
feat(backend): ジョブキュー用Redisを別サーバーに分離できるように
This commit is contained in:
parent
ff6d9d2860
commit
239d3f2dbf
@ -70,6 +70,14 @@ redis:
|
|||||||
# #prefix: example-prefix
|
# #prefix: example-prefix
|
||||||
# #db: 1
|
# #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 └─────────────────────────────
|
#───┘ Elasticsearch configuration └─────────────────────────────
|
||||||
|
|
||||||
|
@ -70,6 +70,14 @@ redis:
|
|||||||
# #prefix: example-prefix
|
# #prefix: example-prefix
|
||||||
# #db: 1
|
# #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 └─────────────────────────────
|
#───┘ Elasticsearch configuration └─────────────────────────────
|
||||||
|
|
||||||
|
@ -70,6 +70,14 @@ redis:
|
|||||||
# #prefix: example-prefix
|
# #prefix: example-prefix
|
||||||
# #db: 1
|
# #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 └─────────────────────────────
|
#───┘ Elasticsearch configuration └─────────────────────────────
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
### Server
|
### Server
|
||||||
- イベント用Redisを別サーバーに分離できるように
|
- イベント用Redisを別サーバーに分離できるように
|
||||||
|
- ジョブキュー用Redisを別サーバーに分離できるように
|
||||||
- サーバーの全体的なパフォーマンスを向上
|
- サーバーの全体的なパフォーマンスを向上
|
||||||
- ノート作成時のパフォーマンスを向上
|
- ノート作成時のパフォーマンスを向上
|
||||||
- アンテナのタイムライン取得時のパフォーマンスを向上
|
- アンテナのタイムライン取得時のパフォーマンスを向上
|
||||||
|
@ -91,6 +91,14 @@ redis:
|
|||||||
# #prefix: example-prefix
|
# #prefix: example-prefix
|
||||||
# #db: 1
|
# #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 └─────────────────────────────
|
#───┘ Elasticsearch configuration └─────────────────────────────
|
||||||
|
|
||||||
|
@ -41,6 +41,14 @@ export type Source = {
|
|||||||
db?: number;
|
db?: number;
|
||||||
prefix?: string;
|
prefix?: string;
|
||||||
};
|
};
|
||||||
|
redisForJobQueue?: {
|
||||||
|
host: string;
|
||||||
|
port: number;
|
||||||
|
family?: number;
|
||||||
|
pass: string;
|
||||||
|
db?: number;
|
||||||
|
prefix?: string;
|
||||||
|
};
|
||||||
elasticsearch: {
|
elasticsearch: {
|
||||||
host: string;
|
host: string;
|
||||||
port: number;
|
port: number;
|
||||||
@ -99,6 +107,8 @@ export type Mixin = {
|
|||||||
mediaProxy: string;
|
mediaProxy: string;
|
||||||
externalMediaProxyEnabled: boolean;
|
externalMediaProxyEnabled: boolean;
|
||||||
videoThumbnailGenerator: string | null;
|
videoThumbnailGenerator: string | null;
|
||||||
|
redisForPubsub: NonNullable<Source['redisForPubsub']>;
|
||||||
|
redisForJobQueue: NonNullable<Source['redisForJobQueue']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Config = Source & Mixin;
|
export type Config = Source & Mixin;
|
||||||
@ -160,6 +170,7 @@ export function loadConfig() {
|
|||||||
|
|
||||||
if (!config.redis.prefix) config.redis.prefix = mixin.host;
|
if (!config.redis.prefix) config.redis.prefix = mixin.host;
|
||||||
if (config.redisForPubsub == null) config.redisForPubsub = config.redis;
|
if (config.redisForPubsub == null) config.redisForPubsub = config.redis;
|
||||||
|
if (config.redisForJobQueue == null) config.redisForJobQueue = config.redis;
|
||||||
|
|
||||||
return Object.assign(config, mixin);
|
return Object.assign(config, mixin);
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,13 @@ import type { DeliverJobData, InboxJobData, DbJobData, ObjectStorageJobData, End
|
|||||||
function q<T>(config: Config, name: string, limitPerSec = -1) {
|
function q<T>(config: Config, name: string, limitPerSec = -1) {
|
||||||
return new Bull<T>(name, {
|
return new Bull<T>(name, {
|
||||||
redis: {
|
redis: {
|
||||||
port: config.redis.port,
|
port: config.redisForJobQueue.port,
|
||||||
host: config.redis.host,
|
host: config.redisForJobQueue.host,
|
||||||
family: config.redis.family == null ? 0 : config.redis.family,
|
family: config.redisForJobQueue.family == null ? 0 : config.redisForJobQueue.family,
|
||||||
password: config.redis.pass,
|
password: config.redisForJobQueue.pass,
|
||||||
db: config.redis.db ?? 0,
|
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 ? {
|
limiter: limitPerSec > 0 ? {
|
||||||
max: limitPerSec,
|
max: limitPerSec,
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
|
Loading…
Reference in New Issue
Block a user