mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
fix performance drop in notes/mentions endpoint
This commit is contained in:
parent
dae544b353
commit
6fe335f843
1 changed files with 5 additions and 4 deletions
|
@ -64,9 +64,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'),
|
||||
ps.sinceId, ps.untilId)
|
||||
.andWhere(new Brackets(qb => qb
|
||||
.orWhere(':meId = ANY (note.mentions)')
|
||||
.orWhere(':meId = ANY (note.visibleUserIds)')))
|
||||
.setParameters({ meId: me.id })
|
||||
.where(':meIdAsList <@ note.mentions')
|
||||
.orWhere(':meIdAsList <@ note.visibleUserIds')))
|
||||
.setParameters({ meIdAsList: [me.id] })
|
||||
// Avoid scanning primary key index
|
||||
.orderBy('CONCAT(note.id)', 'DESC')
|
||||
.innerJoinAndSelect('note.user', 'user')
|
||||
|
@ -80,7 +80,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
this.queryService.generateMutedUserQueryForNotes(query, me);
|
||||
this.queryService.generateMutedNoteThreadQuery(query, me);
|
||||
this.queryService.generateBlockedUserQueryForNotes(query, me);
|
||||
this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
|
||||
// A renote can't mention a user, so it will never appear here anyway.
|
||||
//this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
|
||||
|
||||
if (ps.visibility) {
|
||||
query.andWhere('note.visibility = :visibility', { visibility: ps.visibility });
|
||||
|
|
Loading…
Add table
Reference in a new issue