Browse Source

fix redis-cache.service and keyv/redis version

pull/4270/merge^2
HarukaKishida 1 month ago
parent
commit
c809719fca
  1. 8
      apps/api/src/app/redis-cache/redis-cache.service.ts
  2. 2
      package-lock.json
  3. 2
      package.json

8
apps/api/src/app/redis-cache/redis-cache.service.ts

@ -21,10 +21,9 @@ export class RedisCacheService {
public async getKeys(aPrefix?: string): Promise<string[]> { public async getKeys(aPrefix?: string): Promise<string[]> {
const prefix = aPrefix; const prefix = aPrefix;
const keyList = []; const keyList = [];
this.cache.stores[0].iterator((key) => { this.cache.stores[0].iterator((key) => {
if (prefix && key.startsWith(prefix)) { if ((prefix && key.startsWith(prefix)) || !prefix) {
keyList.push(key);
} else if (!prefix) {
keyList.push(key); keyList.push(key);
} }
}); });
@ -58,9 +57,8 @@ export class RedisCacheService {
public async isHealthy() { public async isHealthy() {
try { try {
const client = this.cache.stores[0];
const isHealthy = await Promise.race([ const isHealthy = await Promise.race([
client.ttl, this.getKeys(),
new Promise((_, reject) => new Promise((_, reject) =>
setTimeout( setTimeout(
() => reject(new Error('Redis health check timeout')), () => reject(new Error('Redis health check timeout')),

2
package-lock.json

@ -30,7 +30,7 @@
"@dfinity/principal": "0.15.7", "@dfinity/principal": "0.15.7",
"@dinero.js/currencies": "2.0.0-alpha.8", "@dinero.js/currencies": "2.0.0-alpha.8",
"@internationalized/number": "3.6.0", "@internationalized/number": "3.6.0",
"@keyv/redis": "^4.2.0", "@keyv/redis": "^4.3.1",
"@nestjs/bull": "11.0.1", "@nestjs/bull": "11.0.1",
"@nestjs/cache-manager": "3.0.0", "@nestjs/cache-manager": "3.0.0",
"@nestjs/common": "11.0.6", "@nestjs/common": "11.0.6",

2
package.json

@ -76,7 +76,7 @@
"@dfinity/principal": "0.15.7", "@dfinity/principal": "0.15.7",
"@dinero.js/currencies": "2.0.0-alpha.8", "@dinero.js/currencies": "2.0.0-alpha.8",
"@internationalized/number": "3.6.0", "@internationalized/number": "3.6.0",
"@keyv/redis": "^4.2.0", "@keyv/redis": "^4.3.1",
"@nestjs/bull": "11.0.1", "@nestjs/bull": "11.0.1",
"@nestjs/cache-manager": "3.0.0", "@nestjs/cache-manager": "3.0.0",
"@nestjs/common": "11.0.6", "@nestjs/common": "11.0.6",

Loading…
Cancel
Save