fix(backend): undefined result error

This commit is contained in:
taichanne30 2023-10-25 23:18:29 +09:00
parent 1d9b5ae1ba
commit a3e16ba1bf
No known key found for this signature in database
GPG Key ID: 1D5EE39F870DC283
1 changed files with 1 additions and 1 deletions

View File

@ -52,7 +52,7 @@ export class FeaturedService {
`${name}:${currentWindow}`, 0, threshold, 'REV', 'WITHSCORES');
redisPipeline.zrange(
`${name}:${previousWindow}`, 0, threshold, 'REV', 'WITHSCORES');
const [currentRankingResult, previousRankingResult] = await redisPipeline.exec().then(result => result ? result.map(r => r[1] as string[]) : [[], []]);
const [currentRankingResult, previousRankingResult] = await redisPipeline.exec().then(result => result ? result.map(r => (r[1] || []) as string[]) : [[], []]);
const ranking = new Map<string, number>();
for (let i = 0; i < currentRankingResult.length; i += 2) {