Skip to content

Commit

Permalink
fix close task in queue manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ArceDanielShok committed May 22, 2024
1 parent 641e1cf commit 0415fbd
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/apps/sync-engine/BindingManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,25 +175,29 @@ export class BindingsManager {
} catch (error) {
Logger.error('notify: ', error);
Sentry.captureException(error);
await callback(false, '');
// if (this.processingReject) this.processingReject(error);
// await callback(false, '');
fs.unlinkSync(path);

Logger.debug('[Fetch Data Callback] Finish...', path);

if (this.processingResolve) this.processingResolve();
return;
}
if (!this.processingResolve) {
await this.controllers.notifyPlaceholderHydrationFinished.execute(
contentsId
);
}
fs.unlinkSync(path);
Logger.debug('[Fetch Data Callback] Finish...', path);

await this.controllers.notifyPlaceholderHydrationFinished.execute(
contentsId
);
if (this.processingResolve) this.processingResolve();

ipcRenderer.send('CHECK_SYNC');
Logger.debug('[Fetch Data Callback] Finish...', path);
} catch (error) {
Logger.error(error);
Sentry.captureException(error);
await callback(false, '');
if (this.processingResolve) this.processingResolve();
await this.container.virtualDrive.closeDownloadMutex();
ipcRenderer.send('CHECK_SYNC');
if (this.processingResolve) this.processingResolve();
}
},
notifyMessageCallback: (
Expand Down Expand Up @@ -223,6 +227,7 @@ export class BindingsManager {
},
cancelFetchDataCallback: () => {
// TODO: clean up temp file, free up space of placeholder
if (this.processingResolve) this.processingResolve();
Logger.debug('cancelFetchDataCallback');
},
fetchPlaceholdersCallback: () => {
Expand Down Expand Up @@ -305,6 +310,8 @@ export class BindingsManager {
// Esperar hasta que fetchDataCallback resuelva o rechace la promesa
await processingPromise;

ipcRenderer.send('CHECK_SYNC');

Logger.debug('[Handle Hydrate Callback] Finish begins', task.path);
} catch (error) {
Logger.error(`error hydrating file ${task.path}`);
Expand Down

0 comments on commit 0415fbd

Please sign in to comment.