Skip to content

Commit e2ee6c2

Browse files
authored
Merge pull request #135 from game-node-app/dev
Fix issue with cache key conflicting with typeorm cache method
2 parents 1f36c74 + d853eea commit e2ee6c2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/statistics/game-statistics.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ export class GameStatisticsService implements StatisticsService {
4141
private readonly cacheManager: Cache,
4242
) {}
4343

44-
private getCachedStatistics(period: StatisticsPeriod) {
45-
return this.cacheManager.get<GameStatistics[]>(
44+
private async getCachedStatistics(period: StatisticsPeriod) {
45+
const cachedStatistics = await this.cacheManager.get<GameStatistics[]>(
4646
`trending-games-statistics-${period}`,
4747
);
48+
if (cachedStatistics != undefined && !Array.isArray(cachedStatistics)) {
49+
return undefined;
50+
}
51+
52+
return cachedStatistics;
4853
}
4954

5055
private setCachedStatistics(

0 commit comments

Comments
 (0)