mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:06:56 -04:00
fix issues with 2,000,000 files being uploaded
This commit is contained in:
parent
3a03667a44
commit
72dc676cb8
@ -127,7 +127,11 @@ export const checkForDuplicates = async (files: string[], { concurrency, skipHas
|
||||
|
||||
while (retries < maxRetries) {
|
||||
try {
|
||||
const response = await checkBulkUpload({ assetBulkUploadCheckDto: { assets: results } });
|
||||
const chunks = chunk(results, 1000);
|
||||
|
||||
await Promise.all(
|
||||
chunks.map(async (chunk) => {
|
||||
const response = await checkBulkUpload({ assetBulkUploadCheckDto: { assets: chunk } });
|
||||
|
||||
for (const { id: filepath, assetId, action } of response.results) {
|
||||
if (action === Action.Accept) {
|
||||
@ -137,7 +141,8 @@ export const checkForDuplicates = async (files: string[], { concurrency, skipHas
|
||||
duplicates.push({ id: assetId as string, filepath });
|
||||
}
|
||||
}
|
||||
|
||||
}),
|
||||
);
|
||||
break;
|
||||
} catch (error: any) {
|
||||
retries++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user