summaryrefslogtreecommitdiff
path: root/packages/backend/src/core
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-09 15:34:03 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-09 15:34:03 +0900
commit3a4039e2e1920d7aebd90792f47a84c5b748f2af (patch)
tree3524e5e5f1ec627cd7e30fc079bd4f75d43ef92d /packages/backend/src/core
parentlint fixes (diff)
downloadmisskey-3a4039e2e1920d7aebd90792f47a84c5b748f2af.tar.gz
misskey-3a4039e2e1920d7aebd90792f47a84c5b748f2af.tar.bz2
misskey-3a4039e2e1920d7aebd90792f47a84c5b748f2af.zip
refactor
Diffstat (limited to 'packages/backend/src/core')
-rw-r--r--packages/backend/src/core/FeaturedService.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/backend/src/core/FeaturedService.ts b/packages/backend/src/core/FeaturedService.ts
index 9330d1a840..cccbbd95cb 100644
--- a/packages/backend/src/core/FeaturedService.ts
+++ b/packages/backend/src/core/FeaturedService.ts
@@ -47,12 +47,12 @@ export class FeaturedService {
const currentWindow = this.getCurrentWindow(windowRange);
const previousWindow = currentWindow - 1;
- const [currentRankingResult, previousRankingResult] = await Promise.all([
- this.redisClient.zrange(
- `${name}:${currentWindow}`, 0, threshold, 'REV', 'WITHSCORES'),
- this.redisClient.zrange(
- `${name}:${previousWindow}`, 0, threshold, 'REV', 'WITHSCORES'),
- ]);
+ const redisPipeline = this.redisClient.pipeline();
+ redisPipeline.zrange(
+ `${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 ranking = new Map<string, number>();
for (let i = 0; i < currentRankingResult.length; i += 2) {