1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-27 00:44:38 +02:00

fix(backend): 削除対象ノート検索処理の一部クエリを簡略化 (#17422)

* fix: update related tests

* fix CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>

---------

Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
おさむのひと
2026-05-21 22:00:18 +09:00
committed by GitHub
parent 7fb540edb6
commit e7430057e6
3 changed files with 640 additions and 4 deletions

View File

@@ -227,10 +227,16 @@ export class CleanRemoteNotesProcessorService {
if (currentLimit <= minimumLimit) {
job.log('Local note tree complexity is too high, finding next root note...');
// This query is only used to advance the cursor past the offending range;
// it intentionally omits the heavy NOT EXISTS subqueries in `removalCriteria`
// (user_note_pining / note_favorite / note_reaction) which would otherwise
// hit the same statement_timeout that triggered this fallback path (#17057).
// Strict removability is re-evaluated by the next iteration's CTE query.
const idWindow = await this.notesRepository.createQueryBuilder('note')
.select('id')
.where('note.id > :cursorLeft')
.andWhere(removalCriteria)
.andWhere('note."id" < :newestLimit')
.andWhere('note."userHost" IS NOT NULL')
.andWhere({ replyId: IsNull(), renoteId: IsNull() })
.orderBy('note.id', 'ASC')
.limit(minimumLimit + 1)