summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2020-02-15 23:01:41 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2020-02-15 23:01:41 +0900
commitbef67fa275f12266d64bb01681e69917deec271c (patch)
treed1f7949b5514c21f30289d607d45369b347fb9f2
parent:art: (diff)
downloadsharkey-bef67fa275f12266d64bb01681e69917deec271c.tar.gz
sharkey-bef67fa275f12266d64bb01681e69917deec271c.tar.bz2
sharkey-bef67fa275f12266d64bb01681e69917deec271c.zip
Update trend.ts
-rw-r--r--src/server/api/endpoints/hashtags/trend.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/api/endpoints/hashtags/trend.ts b/src/server/api/endpoints/hashtags/trend.ts
index 0cfc62efba..740b6de4d7 100644
--- a/src/server/api/endpoints/hashtags/trend.ts
+++ b/src/server/api/endpoints/hashtags/trend.ts
@@ -11,7 +11,7 @@ import { Note } from '../../../../models/entities/note';
..が理想だけどPostgreSQLでどうするのか分からないので単に「直近Aの内に投稿されたユニーク投稿数が多いハッシュタグ」で妥協する
*/
-const rangeA = 1000 * 60 * 30; // 30分
+const rangeA = 1000 * 60 * 60; // 60分
//const rangeB = 1000 * 60 * 120; // 2時間
//const coefficient = 1.25; // 「n倍」の部分
//const requiredUsers = 3; // 最低何人がそのタグを投稿している必要があるか
@@ -123,16 +123,16 @@ export default define(meta, async () => {
}
const countsLog = await Promise.all(countPromises);
+ //#endregion
const totalCounts = await Promise.all(hots.map(tag => Notes.createQueryBuilder('note')
.select('count(distinct note.userId)')
.where(':tag = ANY(note.tags)', { tag: tag })
- .andWhere('note.createdAt > :gt', { gt: new Date(now.getTime() - (interval * range)) })
- .cache(60000) // 1 min
+ .andWhere('note.createdAt > :gt', { gt: new Date(now.getTime() - rangeA) })
+ .cache(60000 * 60) // 60 min
.getRawOne()
.then(x => parseInt(x.count, 10))
));
- //#endregion
const stats = hots.map((tag, i) => ({
tag,