Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

add runMLSyncJob error logging

Abhinav1ff0de34a4d9
diff --git a/apps/photos/src/services/machineLearning/mlWorkManager.ts b/apps/photos/src/services/machineLearning/mlWorkManager.ts
index 98a21984cc..f6910f8a40 100644
--- a/apps/photos/src/services/machineLearning/mlWorkManager.ts
+++ b/apps/photos/src/services/machineLearning/mlWorkManager.ts
@@ -201,35 +201,39 @@ class MLWorkManager {
}
private async runMLSyncJob(): Promise<MLSyncJobResult> {
- // TODO: skipping is not required if we are caching chunks through service worker
- // currently worker chunk itself is not loaded when network is not there
- if (!navigator.onLine) {
- addLogLine(
- 'Skipping ml-sync job run as not connected to internet.'
- );
- return {
- shouldBackoff: true,
- mlSyncResult: undefined,
- };
- }
+ try {
+ // TODO: skipping is not required if we are caching chunks through service worker
+ // currently worker chunk itself is not loaded when network is not there
+ if (!navigator.onLine) {
+ addLogLine(
+ 'Skipping ml-sync job run as not connected to internet.'
+ );
+ return {
+ shouldBackoff: true,
+ mlSyncResult: undefined,
+ };
+ }
- const token = getToken();
- const userID = getUserID();
- const jobWorkerProxy = await this.getSyncJobWorker();
+ const token = getToken();
+ const userID = getUserID();
+ const jobWorkerProxy = await this.getSyncJobWorker();
- const mlSyncResult = await jobWorkerProxy.sync(token, userID);
+ const mlSyncResult = await jobWorkerProxy.sync(token, userID);
- // this.terminateSyncJobWorker();
- const jobResult: MLSyncJobResult = {
- shouldBackoff:
- !!mlSyncResult.error || mlSyncResult.nOutOfSyncFiles < 1,
- mlSyncResult,
- };
- addLogLine('ML Sync Job result: ', JSON.stringify(jobResult));
+ // this.terminateSyncJobWorker();
+ const jobResult: MLSyncJobResult = {
+ shouldBackoff:
+ !!mlSyncResult.error || mlSyncResult.nOutOfSyncFiles < 1,
+ mlSyncResult,
+ };
+ addLogLine('ML Sync Job result: ', JSON.stringify(jobResult));
- // TODO: redirect/refresh to gallery in case of session_expired, stop ml sync job
+ // TODO: redirect/refresh to gallery in case of session_expired, stop ml sync job
- return jobResult;
+ return jobResult;
+ } catch (e) {
+ logError(e, 'Failed to run MLSync Job');
+ }
}
public async startSyncJob() {