mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 22:49:24 +09:00
enhance(PostgreSQL): DBのクエリーのキャッシュに使われるRedisの設定を分ける (MisskeyIO#322)
This commit is contained in:
parent
f950abcf2c
commit
bb0da10d73
@ -46,6 +46,7 @@ type Source = {
|
|||||||
pass: string;
|
pass: string;
|
||||||
}[];
|
}[];
|
||||||
redis: RedisOptionsSource;
|
redis: RedisOptionsSource;
|
||||||
|
redisForDatabaseCache?: RedisOptionsSource;
|
||||||
redisForPubsub?: RedisOptionsSource;
|
redisForPubsub?: RedisOptionsSource;
|
||||||
redisForJobQueue?: RedisOptionsSource;
|
redisForJobQueue?: RedisOptionsSource;
|
||||||
redisForSystemQueue?: RedisOptionsSource;
|
redisForSystemQueue?: RedisOptionsSource;
|
||||||
@ -176,6 +177,7 @@ export type Config = {
|
|||||||
externalMediaProxyEnabled: boolean;
|
externalMediaProxyEnabled: boolean;
|
||||||
videoThumbnailGenerator: string | null;
|
videoThumbnailGenerator: string | null;
|
||||||
redis: RedisOptions & RedisOptionsSource;
|
redis: RedisOptions & RedisOptionsSource;
|
||||||
|
redisForDatabaseCache: RedisOptions & RedisOptionsSource;
|
||||||
redisForPubsub: RedisOptions & RedisOptionsSource;
|
redisForPubsub: RedisOptions & RedisOptionsSource;
|
||||||
redisForSystemQueue: RedisOptions & RedisOptionsSource;
|
redisForSystemQueue: RedisOptions & RedisOptionsSource;
|
||||||
redisForEndedPollNotificationQueue: RedisOptions & RedisOptionsSource;
|
redisForEndedPollNotificationQueue: RedisOptions & RedisOptionsSource;
|
||||||
@ -251,6 +253,7 @@ export function loadConfig(): Config {
|
|||||||
dbSlaves: config.dbSlaves,
|
dbSlaves: config.dbSlaves,
|
||||||
meilisearch: config.meilisearch,
|
meilisearch: config.meilisearch,
|
||||||
redis,
|
redis,
|
||||||
|
redisForDatabaseCache: config.redisForDatabaseCache ? convertRedisOptions(config.redisForDatabaseCache, host) : redis,
|
||||||
redisForPubsub: config.redisForPubsub ? convertRedisOptions(config.redisForPubsub, host) : redis,
|
redisForPubsub: config.redisForPubsub ? convertRedisOptions(config.redisForPubsub, host) : redis,
|
||||||
redisForSystemQueue: config.redisForSystemQueue ? convertRedisOptions(config.redisForSystemQueue, host) : redisForJobQueue,
|
redisForSystemQueue: config.redisForSystemQueue ? convertRedisOptions(config.redisForSystemQueue, host) : redisForJobQueue,
|
||||||
redisForEndedPollNotificationQueue: config.redisForEndedPollNotificationQueue ? convertRedisOptions(config.redisForEndedPollNotificationQueue, host) : redisForJobQueue,
|
redisForEndedPollNotificationQueue: config.redisForEndedPollNotificationQueue ? convertRedisOptions(config.redisForEndedPollNotificationQueue, host) : redisForJobQueue,
|
||||||
|
@ -230,12 +230,8 @@ export function createPostgresDataSource(config: Config) {
|
|||||||
cache: !config.db.disableCache && process.env.NODE_ENV !== 'test' ? { // dbをcloseしても何故かredisのコネクションが内部的に残り続けるようで、テストの際に支障が出るため無効にする(キャッシュも含めてテストしたいため本当は有効にしたいが...)
|
cache: !config.db.disableCache && process.env.NODE_ENV !== 'test' ? { // dbをcloseしても何故かredisのコネクションが内部的に残り続けるようで、テストの際に支障が出るため無効にする(キャッシュも含めてテストしたいため本当は有効にしたいが...)
|
||||||
type: 'ioredis',
|
type: 'ioredis',
|
||||||
options: {
|
options: {
|
||||||
host: config.redis.host,
|
...config.redisForDatabaseCache,
|
||||||
port: config.redis.port,
|
keyPrefix: `${config.redisForDatabaseCache.prefix}:query:`,
|
||||||
family: config.redis.family ?? 0,
|
|
||||||
password: config.redis.pass,
|
|
||||||
keyPrefix: `${config.redis.prefix}:query:`,
|
|
||||||
db: config.redis.db ?? 0,
|
|
||||||
},
|
},
|
||||||
} : false,
|
} : false,
|
||||||
logging: log,
|
logging: log,
|
||||||
|
Loading…
Reference in New Issue
Block a user