Skip to content

Commit

Permalink
upd: apply same changes to featured
Browse files Browse the repository at this point in the history
  • Loading branch information
Mar0xy committed Nov 1, 2023
1 parent 61c66b3 commit d252dc3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/backend/src/core/FeaturedService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit d252dc3

Please sign in to comment.