From a831876fdcd07fdc178869e55f468f9fde2efb7d Mon Sep 17 00:00:00 2001 From: hwang Date: Mon, 31 Mar 2025 06:30:56 -0500 Subject: [PATCH] fix: MAX_PARAMETERS_EXCEEDED error during person cleanup job (#17222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add batch size in sql delete,fix person cleanup error: ERROR [Microservices:{}] Unable to run job handler (backgroundTask/person-cleanup): Error: MAX_PARAMETERS_EXCEEDED: Max number of parameters (65534) exceeded * add chunked decorator to delete * chore: prettier formatting fixes --------- Co-authored-by: hwang3419 <“hwang.iit@gmail.com”> Co-authored-by: Zack Pollard --- server/src/services/person.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/services/person.service.ts b/server/src/services/person.service.ts index c6c3ce4e4f..65a4508a3b 100644 --- a/server/src/services/person.service.ts +++ b/server/src/services/person.service.ts @@ -1,7 +1,7 @@ import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common'; import { FACE_THUMBNAIL_SIZE, JOBS_ASSET_PAGINATION_SIZE } from 'src/constants'; import { StorageCore } from 'src/cores/storage.core'; -import { OnJob } from 'src/decorators'; +import { Chunked, OnJob } from 'src/decorators'; import { BulkIdErrorReason, BulkIdResponseDto } from 'src/dtos/asset-ids.response.dto'; import { AuthDto } from 'src/dtos/auth.dto'; import { @@ -241,6 +241,7 @@ export class PersonService extends BaseService { return results; } + @Chunked() private async delete(people: PersonEntity[]) { await Promise.all(people.map((person) => this.storageRepository.unlink(person.thumbnailPath))); await this.personRepository.delete(people);