Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/leaderboard/leaderboard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export class LeaderboardService {
private readonly clanService: ClanService,
) {}

/**
* Leaderboard data update interval in second, 3h
*/
private readonly LEADERBOARD_TTL_S = 10800;

/**
* Retrieves the clan leaderboard data.
*
Expand Down Expand Up @@ -73,7 +78,11 @@ export class LeaderboardService {
data = await this.processCacheData(model, fetchedData);

// Set the data with 12 hour ttl. The { ttl: number } as any is required to overwrite the default value.
await this.redisService.set(cacheKey, JSON.stringify(data), 60 * 60 * 12);
await this.redisService.set(
cacheKey,
JSON.stringify(data),
this.LEADERBOARD_TTL_S,
);
}

if (reqQuery) {
Expand Down