π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Start using it
Manav Rathi206a8a538a11
diff --git a/web/apps/photos/src/services/sync.ts b/web/apps/photos/src/services/sync.tsindex dc1699892e..0af6cee42e 100644--- a/web/apps/photos/src/services/sync.ts+++ b/web/apps/photos/src/services/sync.ts@@ -1,10 +1,10 @@import { fetchAndSaveFeatureFlagsIfNeeded } from "@/new/photos/services/feature-flags";+import { triggerMLSync } from "@/new/photos/services/ml";import { isDesktop } from "@/next/app";import { clipService } from "services/clip-service";import { syncCLIPEmbeddings } from "services/embeddingService";import { syncEntities } from "services/entityService";import { syncMapEnabled } from "services/userService";-// import { isFaceIndexingEnabled } from "./face/indexer";/*** Perform a soft "refresh" by making various API calls to fetch state from@@ -21,7 +21,7 @@ export const sync = async () => {fetchAndSaveFeatureFlagsIfNeeded();if (isDesktop) {await syncCLIPEmbeddings();- // if (isFaceIndexingEnabled()) await (await faceWorker()).sync();+ triggerMLSync();void clipService.scheduleImageEmbeddingExtraction();}};diff --git a/web/packages/new/photos/services/ml/index.ts b/web/packages/new/photos/services/ml/index.tsindex 14ad9f73c4..ca957d19c6 100644--- a/web/packages/new/photos/services/ml/index.ts+++ b/web/packages/new/photos/services/ml/index.ts@@ -79,6 +79,21 @@ export const logoutML = async () => {await clearFaceDB();};+/**+ * Trigger a "sync", whatever that means for the ML subsystem.+ *+ * This is called during the global sync sequence. If ML is enabled, then we use+ * this as a signal to pull embeddings from remote, and start backfilling if+ * needed.+ *+ * This function does not wait for these processes to run to completion, and+ * returns immediately.+ */+export const triggerMLSync = () => {+ if (!_isMLEnabled) return;+ void worker().then((w) => w.sync());+};+export interface FaceIndexingStatus {/*** Which phase we are in within the indexing pipeline when viewed across thediff --git a/web/packages/new/photos/services/ml/worker.ts b/web/packages/new/photos/services/ml/worker.tsindex c9e98b8eb8..5123fc33cc 100644--- a/web/packages/new/photos/services/ml/worker.ts+++ b/web/packages/new/photos/services/ml/worker.ts@@ -53,6 +53,10 @@ export class MLWorker {** This function enqueues the pull and returns immediately without waiting* for the pull to complete.+ *+ * While it only triggers a pull, once the pull is done it also checks for+ * pending items to backfill. So it implicitly also triggers a backfill+ * (which is why call it a less-precise sync instead of pull).*/sync() {this.shouldSync = true;