Remove linkage

This commit is contained in:
Manav Rathi 2024-04-24 16:07:28 +05:30
parent 105157c164
commit e217635a1b
No known key found for this signature in database
2 changed files with 11 additions and 10 deletions

View file

@ -429,6 +429,12 @@ class UploadManager {
}
}
private abortIfCancelled = () => {
if (uploadCancelService.isUploadCancelationRequested()) {
throw Error(CustomError.UPLOAD_CANCELLED);
}
};
private async parseMetadataJSONFiles(metadataFiles: FileWithCollection2[]) {
try {
log.info(`parseMetadataJSONFiles function executed `);
@ -436,12 +442,9 @@ class UploadManager {
this.uiService.reset(metadataFiles.length);
for (const { file, collectionID } of metadataFiles) {
this.abortIfCancelled();
const name = getFileName(file);
try {
if (uploadCancelService.isUploadCancelationRequested()) {
throw Error(CustomError.UPLOAD_CANCELLED);
}
log.info(`parsing metadata json file ${name}`);
const metadataJSON =
@ -523,6 +526,9 @@ class UploadManager {
this.parsedMetadataJSONMap,
this.uploaderName,
this.isCFUploadProxyDisabled,
() => {
this.abortIfCancelled();
},
(
fileLocalID: number,
percentPerPart?: number,

View file

@ -58,7 +58,6 @@ import {
generateThumbnailNative,
generateThumbnailWeb,
} from "./thumbnail";
import uploadCancelService from "./uploadCancelService";
import UploadHttpClient from "./uploadHttpClient";
/** Upload files to cloud storage */
@ -168,16 +167,12 @@ export const uploader = async (
parsedMetadataJSONMap: Map<string, ParsedMetadataJSON>,
uploaderName: string,
isCFUploadProxyDisabled: boolean,
abortIfCancelled: () => void,
makeProgessTracker: MakeProgressTracker,
): Promise<UploadResponse> => {
const name = assetName(fileWithCollection);
log.info(`Uploading ${name}`);
const abortIfCancelled = () => {
if (uploadCancelService.isUploadCancelationRequested())
throw Error(CustomError.UPLOAD_CANCELLED);
};
const { collection, localID, ...uploadAsset2 } = fileWithCollection;
/* TODO(MR): ElectronFile changes */
const uploadAsset = uploadAsset2 as UploadAsset;