Skip to content

armgit / ente

Public Imported from GitHub
0

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

Essence

Manav Rathi295f4a0c2a57
diff --git a/web/apps/photos/src/services/face/types.ts b/web/apps/photos/src/services/face/types.ts
index 01186192ab..cbe13da941 100644
--- a/web/apps/photos/src/services/face/types.ts
+++ b/web/apps/photos/src/services/face/types.ts
@@ -3,14 +3,6 @@ import { Dimensions } from "services/face/geom";
import { EnteFile } from "types/file";
import { Box, Point } from "./geom";
-export interface MLSyncResult {
- nOutOfSyncFiles: number;
- nSyncedFiles: number;
- nSyncedFaces: number;
- nFaceClusters: number;
- error?: Error;
-}
-
export declare type FaceDescriptor = Float32Array;
export declare type Cluster = Array<number>;
diff --git a/web/apps/photos/src/services/machineLearning/machineLearningService.ts b/web/apps/photos/src/services/machineLearning/machineLearningService.ts
index 2f01aec516..3703f1dfde 100644
--- a/web/apps/photos/src/services/machineLearning/machineLearningService.ts
+++ b/web/apps/photos/src/services/machineLearning/machineLearningService.ts
@@ -16,7 +16,6 @@ import {
MLLibraryData,
MLSearchConfig,
MLSyncFileContext,
- MLSyncResult,
MlFileData,
} from "services/face/types";
import { getLocalFiles } from "services/fileService";
@@ -151,7 +150,7 @@ class MachineLearningService {
private localSyncContext: Promise<MLSyncContext>;
private syncContext: Promise<MLSyncContext>;
- public async sync(token: string, userID: number): Promise<MLSyncResult> {
+ public async sync(token: string, userID: number): Promise<boolean> {
if (!token) {
throw Error("Token needed by ml service to sync file");
}
@@ -180,18 +179,9 @@ class MachineLearningService {
}
*/
- const mlSyncResult: MLSyncResult = {
- nOutOfSyncFiles: syncContext.outOfSyncFiles.length,
- nSyncedFiles: syncContext.nSyncedFiles,
- nSyncedFaces: syncContext.nSyncedFaces,
- nFaceClusters:
- syncContext.mlLibraryData?.faceClusteringResults?.clusters
- .length,
- error: syncContext.error,
- };
- // log.info('[MLService] sync results: ', mlSyncResult);
-
- return mlSyncResult;
+ const error = syncContext.error;
+ const nOutOfSyncFiles = syncContext.outOfSyncFiles.length;
+ return !error && nOutOfSyncFiles > 0;
}
public async regenerateFaceCrop(faceID: string) {
diff --git a/web/apps/photos/src/services/machineLearning/mlWorkManager.ts b/web/apps/photos/src/services/machineLearning/mlWorkManager.ts
index d1421ac6bd..4653733545 100644
--- a/web/apps/photos/src/services/machineLearning/mlWorkManager.ts
+++ b/web/apps/photos/src/services/machineLearning/mlWorkManager.ts
@@ -269,11 +269,8 @@ class MLWorkManager {
const userID = getUserID();
const jobWorkerProxy = await this.getSyncJobWorker();
- const mlSyncResult = await jobWorkerProxy.sync(token, userID);
-
+ return await jobWorkerProxy.sync(token, userID);
// this.terminateSyncJobWorker();
- return !mlSyncResult.error && mlSyncResult.nOutOfSyncFiles > 0;
-
// TODO: redirect/refresh to gallery in case of session_expired, stop ml sync job
} catch (e) {
log.error("Failed to run MLSync Job", e);