fix(backend): TLを途中までしかページネーションできなくなることがある問題を修正

Fix #11404
This commit is contained in:
syuilo 2023-10-09 16:47:46 +09:00
parent 19a507633e
commit 0f367da84b
3 changed files with 8 additions and 0 deletions

View file

@ -77,6 +77,9 @@ export class AntennaService implements OnApplicationShutdown {
@bindThis
public async addNoteToAntennas(note: MiNote, noteUser: { id: MiUser['id']; username: string; host: string | null; }): Promise<void> {
// リモートから遅れて届いた(もしくは後から追加された)投稿日時が古い投稿が追加されるとページネーション時に問題を引き起こすため、3分以内に投稿されたもののみを追加する
if (Date.now() - note.createdAt.getTime() > 1000 * 60 * 3) return;
const antennas = await this.getAntennas();
const antennasWithMatchResult = await Promise.all(antennas.map(antenna => this.checkHitAntenna(antenna, note, noteUser).then(hit => [antenna, hit] as const)));
const matchedAntennas = antennasWithMatchResult.filter(([, hit]) => hit).map(([antenna]) => antenna);