summaryrefslogtreecommitdiff
path: root/packages/backend/src
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-09 13:22:58 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-09 13:22:58 +0900
commita2d3544a080597349dfd3e77d2160b077012c070 (patch)
treefad45f380c2e3cf47faf1d2bf995eac2f53c0f0b /packages/backend/src
parent2023.10.0-beta.10 (diff)
downloadsharkey-a2d3544a080597349dfd3e77d2160b077012c070.tar.gz
sharkey-a2d3544a080597349dfd3e77d2160b077012c070.tar.bz2
sharkey-a2d3544a080597349dfd3e77d2160b077012c070.zip
refactor(backend): better argument name
Diffstat (limited to 'packages/backend/src')
-rw-r--r--packages/backend/src/core/FeaturedService.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/packages/backend/src/core/FeaturedService.ts b/packages/backend/src/core/FeaturedService.ts
index 62b50ed38d..9330d1a840 100644
--- a/packages/backend/src/core/FeaturedService.ts
+++ b/packages/backend/src/core/FeaturedService.ts
@@ -43,15 +43,15 @@ export class FeaturedService {
}
@bindThis
- private async getRankingOf(name: string, windowRange: number, limit: number): Promise<string[]> {
+ private async getRankingOf(name: string, windowRange: number, threshold: number): Promise<string[]> {
const currentWindow = this.getCurrentWindow(windowRange);
const previousWindow = currentWindow - 1;
const [currentRankingResult, previousRankingResult] = await Promise.all([
this.redisClient.zrange(
- `${name}:${currentWindow}`, 0, limit, 'REV', 'WITHSCORES'),
+ `${name}:${currentWindow}`, 0, threshold, 'REV', 'WITHSCORES'),
this.redisClient.zrange(
- `${name}:${previousWindow}`, 0, limit, 'REV', 'WITHSCORES'),
+ `${name}:${previousWindow}`, 0, threshold, 'REV', 'WITHSCORES'),
]);
const ranking = new Map<string, number>();
@@ -95,22 +95,22 @@ export class FeaturedService {
}
@bindThis
- public getGlobalNotesRanking(limit: number): Promise<MiNote['id'][]> {
- return this.getRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, limit);
+ public getGlobalNotesRanking(threshold: number): Promise<MiNote['id'][]> {
+ return this.getRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, threshold);
}
@bindThis
- public getInChannelNotesRanking(channelId: MiNote['channelId'], limit: number): Promise<MiNote['id'][]> {
- return this.getRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, limit);
+ public getInChannelNotesRanking(channelId: MiNote['channelId'], threshold: number): Promise<MiNote['id'][]> {
+ return this.getRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, threshold);
}
@bindThis
- public getPerUserNotesRanking(userId: MiUser['id'], limit: number): Promise<MiNote['id'][]> {
- return this.getRankingOf(`featuredPerUserNotesRanking:${userId}`, PER_USER_NOTES_RANKING_WINDOW, limit);
+ public getPerUserNotesRanking(userId: MiUser['id'], threshold: number): Promise<MiNote['id'][]> {
+ return this.getRankingOf(`featuredPerUserNotesRanking:${userId}`, PER_USER_NOTES_RANKING_WINDOW, threshold);
}
@bindThis
- public getHashtagsRanking(limit: number): Promise<string[]> {
- return this.getRankingOf('featuredHashtagsRanking', HASHTAG_RANKING_WINDOW, limit);
+ public getHashtagsRanking(threshold: number): Promise<string[]> {
+ return this.getRankingOf('featuredHashtagsRanking', HASHTAG_RANKING_WINDOW, threshold);
}
}