Skip to content

Commit

Permalink
fix: 포커 결과 계산시 레디스 TTL 활용
Browse files Browse the repository at this point in the history
  • Loading branch information
w8385 committed Feb 14, 2024
1 parent 1fe9743 commit cd3bc48
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/poker/poker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ export class PokerService {
}

async calc(pokerId: string) {
try {
return await this.redisClient.json.get('result_' + pokerId);
} catch (_) {}
const lastResult = await this.redisClient.json.get('result_' + pokerId);
if (lastResult !== null) {
return lastResult;
}

const poker = await this.redisClient.json.get(pokerId);
const result = {
Expand Down

0 comments on commit cd3bc48

Please sign in to comment.