Skip to content

armgit / ente

Public Imported from GitHub
0

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

New path

Manav Rathi98979a2271b6
diff --git a/web/apps/photos/src/services/sync.ts b/web/apps/photos/src/services/sync.ts
index ce6b03cbf3..db6946c612 100644
--- a/web/apps/photos/src/services/sync.ts
+++ b/web/apps/photos/src/services/sync.ts
@@ -4,6 +4,7 @@ import {
triggerMLStatusSync,
triggerMLSync,
} from "@/new/photos/services/ml";
+import { syncUserEntities } from "@/new/photos/services/user-entity";
import { syncEntities } from "services/entityService";
import { syncMapEnabled } from "services/userService";
@@ -35,7 +36,10 @@ export const triggerPreFileInfoSync = () => {
* before doing the file sync and thus should run immediately after login.
*/
export const sync = async () => {
- await syncEntities();
- await syncMapEnabled();
+ await Promise.allSettled([
+ syncEntities(),
+ syncUserEntities(),
+ syncMapEnabled(),
+ ]);
if (isMLSupported) triggerMLSync();
};
diff --git a/web/packages/new/photos/services/user-entity.ts b/web/packages/new/photos/services/user-entity.ts
index 927ed08168..723c5ed7b4 100644
--- a/web/packages/new/photos/services/user-entity.ts
+++ b/web/packages/new/photos/services/user-entity.ts
@@ -9,6 +9,7 @@ import { getKV, getKVN, setKV } from "@/base/kv";
import { apiURL } from "@/base/origins";
import { masterKeyFromSession } from "@/base/session-store";
import { ensure } from "@/utils/ensure";
+import { wait } from "@/utils/promise";
import { nullToUndefined } from "@/utils/transform";
import { z } from "zod";
import { gunzip } from "./gzip";
@@ -30,6 +31,18 @@ export type EntityType =
*/
"cgroup";
+/**
+ * Sync our local state with the user entities present on remote.
+ *
+ * This function fetches all the user entity types that we are interested in for
+ * the photos app – location tags and cgroups – from remote and updates our
+ * local database. It uses local state to remember the last time it synced, so
+ * each subsequent sync is a lightweight diff.
+ */
+export const syncUserEntities = async () => {
+ return wait(0);
+};
+
/**
* The maximum number of items to fetch in a single diff
*