Skip to content

Commit

Permalink
🔧 Prevent metadata.json update if the sync time value is the same (#3398
Browse files Browse the repository at this point in the history
)

* prevent metadata.json update if the sync time value is the same as the saved one

* release notes
  • Loading branch information
MikesGlitch authored Sep 8, 2024
1 parent cb0411b commit 21dc573
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/loot-core/src/server/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3398.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MikesGlitch]
---

Prevent sync from saving to metadata.json unnecessarily

0 comments on commit 21dc573

Please sign in to comment.