mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-21 17:37:29 -07:00
[backend] Use more efficient home timeline heuristics query
This commit is contained in:
parent
b9b669570b
commit
7aa3bdb641
1 changed files with 6 additions and 1 deletions
|
@ -23,7 +23,12 @@ export async function generateFollowingQuery(
|
|||
return Notes.createQueryBuilder('note')
|
||||
.where(`note.createdAt > :prev`, { prev })
|
||||
.andWhere(`note.createdAt < :curr`, { curr })
|
||||
.andWhere(`note.userId = ANY(array(${followingQuery.getQuery()} UNION ALL VALUES (:meId)))`, { meId: me.id })
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.where(`note.userId IN (${followingQuery.getQuery()})`);
|
||||
qb.orWhere(`note.userId = :meId`, { meId: me.id });
|
||||
})
|
||||
)
|
||||
.getCount()
|
||||
.then(res => {
|
||||
logger.info(`Calculating heuristics for user ${me.id} took ${new Date().getTime() - curr.getTime()}ms`);
|
||||
|
|
Loading…
Reference in a new issue