Skip to content

armgit / ente

Public Imported from GitHub
0

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

Untrig

Manav Rathi87f9537bb24b
diff --git a/web/apps/photos/src/services/sync.ts b/web/apps/photos/src/services/sync.ts
index eff5b4d6d1..5530b42753 100644
--- a/web/apps/photos/src/services/sync.ts
+++ b/web/apps/photos/src/services/sync.ts
@@ -2,7 +2,7 @@ import { triggerFeatureFlagsFetchIfNeeded } from "@/new/photos/services/feature-
import {
isMLSupported,
mlStatusSync,
- triggerMLSync,
+ mlSync,
wipClusterEnable,
} from "@/new/photos/services/ml";
import { syncCGroups } from "@/new/photos/services/ml/cgroups";
@@ -46,7 +46,7 @@ export const sync = async () => {
wipClusterEnable().then((enable) =>
enable ? syncCGroups().then(rereadCGroups) : undefined,
),
+ isMLSupported && mlSync(),
]);
triggerSearchDataSync();
- if (isMLSupported) triggerMLSync();
};
diff --git a/web/packages/new/photos/services/ml/index.ts b/web/packages/new/photos/services/ml/index.ts
index 65c7bb88fc..1da7869136 100644
--- a/web/packages/new/photos/services/ml/index.ts
+++ b/web/packages/new/photos/services/ml/index.ts
@@ -207,8 +207,8 @@ export const enableML = async () => {
setIsMLEnabledLocal(true);
_state.isMLEnabled = true;
setInterimScheduledStatus();
- triggerStatusUpdate();
- triggerMLSync();
+ // Trigger updates, but don't wait for them to finish.
+ void updateMLStatusSnapshot().then(mlSync);
};
/**
@@ -288,7 +288,7 @@ export const mlStatusSync = async () => {
};
/**
- * Trigger a ML sync.
+ * Perform a ML sync.
*
* This is called during the global sync sequence, after files information have
* been synced with remote.
@@ -299,9 +299,7 @@ export const mlStatusSync = async () => {
* This will only have an effect if {@link mlStatusSync} has been called at
* least once prior to calling this in the sync sequence.
*/
-export const triggerMLSync = () => void mlSync();
-
-const mlSync = async () => {
+export const mlSync = async () => {
if (_state.isMLEnabled) await worker().then((w) => w.sync());
};
@@ -514,12 +512,12 @@ export const mlStatusSnapshot = (): MLStatus | undefined => {
};
/**
- * Trigger an asynchronous and unconditional update of the {@link MLStatus}
- * snapshot.
+ * Trigger an asynchronous update of the {@link MLStatus} snapshot, and return
+ * without waiting for it to finish.
*/
const triggerStatusUpdate = () => void updateMLStatusSnapshot();
-/** Unconditional update of the {@link MLStatus} snapshot. */
+/** Unconditionally update of the {@link MLStatus} snapshot. */
const updateMLStatusSnapshot = async () =>
setMLStatusSnapshot(await getMLStatus());