mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:06:56 -04:00
add todos
This commit is contained in:
parent
5c9ef5c6fd
commit
8e130a6e3e
@ -190,6 +190,8 @@ describe('checkForDuplicates', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: this shouldn't return empty arrays, this should return an error
|
||||
// Failed duplicate checks should be a reason for panic instead of ignoring
|
||||
it('returns results when check duplicates retry is failed', async () => {
|
||||
vi.mocked(checkBulkUpload).mockRejectedValue(new Error('Network error'));
|
||||
|
||||
|
@ -122,14 +122,20 @@ export const checkForDuplicates = async (files: string[], { concurrency, skipHas
|
||||
const newFiles: string[] = [];
|
||||
const duplicates: Asset[] = [];
|
||||
|
||||
const response = await checkBulkUpload({ assetBulkUploadCheckDto: { assets: results } });
|
||||
for (const { id: filepath, assetId, action } of response.results) {
|
||||
if (action === Action.Accept) {
|
||||
newFiles.push(filepath);
|
||||
} else {
|
||||
// rejects are always duplicates
|
||||
duplicates.push({ id: assetId as string, filepath });
|
||||
// TODO: Retry 3 times if there is an error
|
||||
try {
|
||||
const response = await checkBulkUpload({ assetBulkUploadCheckDto: { assets: results } });
|
||||
|
||||
for (const { id: filepath, assetId, action } of response.results) {
|
||||
if (action === Action.Accept) {
|
||||
newFiles.push(filepath);
|
||||
} else {
|
||||
// rejects are always duplicates
|
||||
duplicates.push({ id: assetId as string, filepath });
|
||||
}
|
||||
}
|
||||
} catch (error: any) {
|
||||
throw new Error(`An error occurred while checking for duplicates: ${error.message}`);
|
||||
}
|
||||
|
||||
progressBar.stop();
|
||||
|
Loading…
x
Reference in New Issue
Block a user