perf(backend): use limit() instead of take()

This commit is contained in:
syuilo 2023-07-08 16:53:07 +09:00
parent b056e8f5eb
commit 081a14d6f3
71 changed files with 76 additions and 75 deletions

View file

@ -41,7 +41,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
.andWhere('channel.isArchived = FALSE')
.orderBy('channel.lastNotedAt', 'DESC');
const channels = await query.take(10).getMany();
const channels = await query.limit(10).getMany();
return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me)));
});

View file

@ -48,7 +48,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
.andWhere({ followerId: me.id });
const followings = await query
.take(ps.limit)
.limit(ps.limit)
.getMany();
return await Promise.all(followings.map(x => this.channelEntityService.pack(x.followeeId, me)));

View file

@ -49,7 +49,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
.andWhere({ userId: me.id });
const channels = await query
.take(ps.limit)
.limit(ps.limit)
.getMany();
return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me)));

View file

@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
}
const channels = await query
.take(ps.limit)
.limit(ps.limit)
.getMany();
return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me)));

View file

@ -105,7 +105,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
}
//#endregion
timeline = await query.take(ps.limit).getMany();
timeline = await query.limit(ps.limit).getMany();
} else {
const noteIds = noteIdsRes.map(x => x[1][1]).filter(x => x !== ps.untilId);