mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix(server): library import batch size (#27595)
* lower batch size * update test
This commit is contained in:
@@ -560,7 +560,7 @@ describe(LibraryService.name, () => {
|
||||
paths: ['/data/user1/photo.jpg'],
|
||||
};
|
||||
|
||||
mocks.asset.createAll.mockResolvedValue([asset]);
|
||||
mocks.asset.createAll.mockResolvedValue([asset.id]);
|
||||
mocks.library.get.mockResolvedValue(library);
|
||||
|
||||
await expect(sut.handleSyncFiles(mockLibraryJob)).resolves.toBe(JobStatus.Success);
|
||||
|
||||
@@ -266,13 +266,7 @@ export class LibraryService extends BaseService {
|
||||
),
|
||||
);
|
||||
|
||||
const assetIds: string[] = [];
|
||||
|
||||
for (let i = 0; i < assetImports.length; i += 5000) {
|
||||
// Chunk the imports to avoid the postgres limit of max parameters at once
|
||||
const chunk = assetImports.slice(i, i + 5000);
|
||||
await this.assetRepository.createAll(chunk).then((assets) => assetIds.push(...assets.map((asset) => asset.id)));
|
||||
}
|
||||
const assetIds = await this.assetRepository.createAll(assetImports);
|
||||
|
||||
const progressMessage =
|
||||
job.progressCounter && job.totalAssets
|
||||
|
||||
Reference in New Issue
Block a user