disable TypeORM query cache by default

This commit is contained in:
Hazelnoot 2025-05-30 08:01:01 -04:00
parent b748f9768e
commit 7d79c77842
5 changed files with 19 additions and 9 deletions

View file

@ -115,8 +115,10 @@ db:
user: postgres user: postgres
pass: ci pass: ci
# Whether disable Caching queries # If false, then query results will be cached in redis.
#disableCache: true # If true (default), then queries will not be cached.
# This will reduce database load at the cost of increased Redis traffic and risk of bugs and unpredictable behavior.
#disableCache: false
# Extra Connection options # Extra Connection options
#extra: #extra:

View file

@ -57,8 +57,10 @@ db:
user: postgres user: postgres
pass: postgres pass: postgres
# Whether disable Caching queries # If false, then query results will be cached in redis.
#disableCache: true # If true (default), then queries will not be cached.
# This will reduce database load at the cost of increased Redis traffic and risk of bugs and unpredictable behavior.
#disableCache: false
# Extra Connection options # Extra Connection options
#extra: #extra:

View file

@ -118,8 +118,10 @@ db:
user: example-misskey-user user: example-misskey-user
pass: example-misskey-pass pass: example-misskey-pass
# Whether disable Caching queries # If false, then query results will be cached in redis.
#disableCache: true # If true (default), then queries will not be cached.
# This will reduce database load at the cost of increased Redis traffic and risk of bugs and unpredictable behavior.
#disableCache: false
# Extra Connection options # Extra Connection options
#extra: #extra:

View file

@ -121,8 +121,12 @@ db:
user: sharkey user: sharkey
pass: example-misskey-pass pass: example-misskey-pass
# Whether disable Caching queries # If false, then query results will be cached in redis.
#disableCache: true # If true (default), then queries will not be cached.
# This will reduce database load at the cost of increased Redis traffic and risk of bugs and unpredictable behavior.
#disableCache: false
#
# Extra Connection options # Extra Connection options
#extra: #extra:

View file

@ -306,7 +306,7 @@ export function createPostgresDataSource(config: Config) {
} : {}), } : {}),
synchronize: process.env.NODE_ENV === 'test', synchronize: process.env.NODE_ENV === 'test',
dropSchema: process.env.NODE_ENV === 'test', dropSchema: process.env.NODE_ENV === 'test',
cache: !config.db.disableCache && process.env.NODE_ENV !== 'test' ? { // dbをcloseしても何故かredisのコネクションが内部的に残り続けるようで、テストの際に支障が出るため無効にする(キャッシュも含めてテストしたいため本当は有効にしたいが...) cache: config.db.disableCache === false && process.env.NODE_ENV !== 'test' ? { // dbをcloseしても何故かredisのコネクションが内部的に残り続けるようで、テストの際に支障が出るため無効にする(キャッシュも含めてテストしたいため本当は有効にしたいが...)
type: 'ioredis', type: 'ioredis',
options: { options: {
...config.redis, ...config.redis,