From 21dc573f3f9e38dfbbf75bf821be121bb4f5800f Mon Sep 17 00:00:00 2001 From: Michael Clark <5285928+MikesGlitch@users.noreply.github.com> Date: Sun, 8 Sep 2024 20:28:53 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Prevent=20metadata.json=20update?= =?UTF-8?q?=20if=20the=20sync=20time=20value=20is=20the=20same=20=20(#3398?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * prevent metadata.json update if the sync time value is the same as the saved one * release notes --- packages/loot-core/src/server/sync/index.ts | 14 +++++++++----- upcoming-release-notes/3398.md | 6 ++++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 upcoming-release-notes/3398.md diff --git a/packages/loot-core/src/server/sync/index.ts b/packages/loot-core/src/server/sync/index.ts index 81a4679df7c..843da6e4480 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 00000000000..77d83012409 --- /dev/null +++ b/upcoming-release-notes/3398.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [MikesGlitch] +--- + +Prevent sync from saving to metadata.json unnecessarily