|
@@ -5,18 +5,26 @@ import { getToken, getUserID } from "@ente/shared/storage/localStorage/helpers";
|
|
import { FILE_TYPE } from "constants/file";
|
|
import { FILE_TYPE } from "constants/file";
|
|
import debounce from "debounce";
|
|
import debounce from "debounce";
|
|
import PQueue from "p-queue";
|
|
import PQueue from "p-queue";
|
|
|
|
+import { JobResult } from "types/common/job";
|
|
import { EnteFile } from "types/file";
|
|
import { EnteFile } from "types/file";
|
|
|
|
+import { MLSyncResult } from "types/machineLearning";
|
|
import { getDedicatedMLWorker } from "utils/comlink/ComlinkMLWorker";
|
|
import { getDedicatedMLWorker } from "utils/comlink/ComlinkMLWorker";
|
|
|
|
+import { SimpleJob } from "utils/common/job";
|
|
import { logQueueStats } from "utils/machineLearning";
|
|
import { logQueueStats } from "utils/machineLearning";
|
|
import { getMLSyncJobConfig } from "utils/machineLearning/config";
|
|
import { getMLSyncJobConfig } from "utils/machineLearning/config";
|
|
import mlIDbStorage from "utils/storage/mlIDbStorage";
|
|
import mlIDbStorage from "utils/storage/mlIDbStorage";
|
|
import { DedicatedMLWorker } from "worker/ml.worker";
|
|
import { DedicatedMLWorker } from "worker/ml.worker";
|
|
-import { MLSyncJob, MLSyncJobResult } from "./mlSyncJob";
|
|
|
|
|
|
|
|
const LIVE_SYNC_IDLE_DEBOUNCE_SEC = 30;
|
|
const LIVE_SYNC_IDLE_DEBOUNCE_SEC = 30;
|
|
const LIVE_SYNC_QUEUE_TIMEOUT_SEC = 300;
|
|
const LIVE_SYNC_QUEUE_TIMEOUT_SEC = 300;
|
|
const LOCAL_FILES_UPDATED_DEBOUNCE_SEC = 30;
|
|
const LOCAL_FILES_UPDATED_DEBOUNCE_SEC = 30;
|
|
|
|
|
|
|
|
+export interface MLSyncJobResult extends JobResult {
|
|
|
|
+ mlSyncResult: MLSyncResult;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+export class MLSyncJob extends SimpleJob<MLSyncJobResult> {}
|
|
|
|
+
|
|
class MLWorkManager {
|
|
class MLWorkManager {
|
|
private mlSyncJob: MLSyncJob;
|
|
private mlSyncJob: MLSyncJob;
|
|
private syncJobWorker: ComlinkWorker<typeof DedicatedMLWorker>;
|
|
private syncJobWorker: ComlinkWorker<typeof DedicatedMLWorker>;
|