upd: apply same changes to featured

This commit is contained in:
Mar0xy 2023-11-01 15:00:24 +01:00
parent 61c66b3825
commit d252dc3d93
No known key found for this signature in database
GPG Key ID: 56569BBE47D2C828

View File

@ -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();
}