diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-04-09 10:29:36 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-09 10:29:36 +0900 |
| commit | 8b1362ab03c273f44cbbbb3c9f900301d82aeabd (patch) | |
| tree | 61fda1a1b44776e8d3a4a17511f2d510b6d9791b /packages/backend/src/server/api | |
| parent | Merge pull request #10506 from misskey-dev/develop (diff) | |
| parent | fix(backend): 連合しているインスタンスについて予期せず配... (diff) | |
| download | misskey-8b1362ab03c273f44cbbbb3c9f900301d82aeabd.tar.gz misskey-8b1362ab03c273f44cbbbb3c9f900301d82aeabd.tar.bz2 misskey-8b1362ab03c273f44cbbbb3c9f900301d82aeabd.zip | |
Merge pull request #10543 from misskey-dev/develop
Release: 13.11.1
Diffstat (limited to 'packages/backend/src/server/api')
| -rw-r--r-- | packages/backend/src/server/api/endpoints/channels/timeline.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index 2556557b24..2491d14235 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -75,13 +75,19 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { let timeline: Note[] = []; - const noteIdsRes = await this.redisClient.xrevrange( - `channelTimeline:${channel.id}`, - ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : '+', - '-', - 'COUNT', ps.limit + 1); // untilIdに指定したものも含まれるため+1 + const limit = ps.limit + (ps.untilId ? 1 : 0); // untilIdに指定したものも含まれるため+1 + let noteIdsRes: [string, string[]][] = []; + + if (!ps.sinceId && !ps.sinceDate) { + noteIdsRes = await this.redisClient.xrevrange( + `channelTimeline:${channel.id}`, + ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : ps.untilDate ?? '+', + '-', + 'COUNT', limit); + } - if (noteIdsRes.length === 0) { + // redis から取得していないとき・取得数が足りないとき + if (noteIdsRes.length < limit) { //#region Construct query const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate) .andWhere('note.channelId = :channelId', { channelId: channel.id }) |