From d252dc3d9336dfd33a0ded78a04d0ce0a13bda46 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Wed, 1 Nov 2023 15:00:24 +0100 Subject: [PATCH] upd: apply same changes to featured --- packages/backend/src/core/FeaturedService.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/core/FeaturedService.ts b/packages/backend/src/core/FeaturedService.ts index 9617f83880..7ba707e9e1 100644 --- a/packages/backend/src/core/FeaturedService.ts +++ b/packages/backend/src/core/FeaturedService.ts @@ -35,10 +35,16 @@ export class FeaturedService { `${name}:${currentWindow}`, score, element); - redisTransaction.expire( - `${name}:${currentWindow}`, - (windowRange * 3) / 1000, - 'NX'); // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定 + + const TTL = await this.redisClient.ttl(`${name}:${currentWindow}`); + + if (TTL === -1) { + this.redisClient.expire(`${name}:${currentWindow}`, + (windowRange * 3) / 1000, // 1時間 + //'NX', // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定 + ); + } + await redisTransaction.exec(); }