Skip to content

A local-first personal finance app

🔧 Prevent metadata.json update if the sync time value is the same (#3398)

Michael Clark21dc573f3f9e
diff --git a/packages/loot-core/src/server/sync/index.ts b/packages/loot-core/src/server/sync/index.ts
index 81a4679df7..843da6e448 100644
--- a/packages/loot-core/src/server/sync/index.ts
+++ b/packages/loot-core/src/server/sync/index.ts
@@ -768,11 +768,15 @@ async function _fullSync(
),
);
} else {
- // All synced up, store the current time as a simple optimization
- // for the next sync
- await prefs.savePrefs({
- lastSyncedTimestamp: getClock().timestamp.toString(),
- });
+ // All synced up, store the current time as a simple optimization for the next sync
+ const requiresUpdate =
+ getClock().timestamp.toString() !== lastSyncedTimestamp;
+
+ if (requiresUpdate) {
+ await prefs.savePrefs({
+ lastSyncedTimestamp: getClock().timestamp.toString(),
+ });
+ }
}
return receivedMessages;
diff --git a/upcoming-release-notes/3398.md b/upcoming-release-notes/3398.md
new file mode 100644
index 0000000000..77d8301240
--- /dev/null
+++ b/upcoming-release-notes/3398.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MikesGlitch]
+---
+
+Prevent sync from saving to metadata.json unnecessarily