From 5ff8c01d3a20c1dde72c7d60beb6a45cfb55bda4 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Thu, 3 Jul 2025 17:14:26 +1000 Subject: [PATCH] Fix Bug #3367: Fix that resync state remains true post first successful full sync (#3368) * Reset internal 'resync' flag post first successful sync when --resync is used at application startup --- src/main.d | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main.d b/src/main.d index bd4a0865..4c9443bb 100644 --- a/src/main.d +++ b/src/main.d @@ -1463,8 +1463,19 @@ void performStandardSyncProcess(string localPath, Monitor filesystemMonitor = nu // Cancel out any inotify events from downloading data processInotifyEvents(false); } + + // At this point, we have done a sync from: + // local -> online + // online -> local + // + // Everything now should be 'in sync' and the database correctly populated with data + // If --resync was used, we need to unset this as sync.d performs certain queries depending on if 'resync' is set or not + if (appConfig.getValueBool("resync")) { + // unset 'resync' now that everything has been performed + appConfig.setValueBool("resync" , false); + } } else { - // Normal sync + // Normal sync process // Download data from OneDrive first syncEngineInstance.syncOneDriveAccountToLocalDisk(); if (appConfig.getValueBool("monitor")) { @@ -1505,10 +1516,22 @@ void performStandardSyncProcess(string localPath, Monitor filesystemMonitor = nu } } } + + // At this point, we have done a sync from: + // online -> local + // local -> online (if not doing --download-only) + // online -> local (if not doing --download-only) + // + // Everything now should be 'in sync' and the database correctly populated with data + // If --resync was used, we need to unset this as sync.d performs certain queries depending on if 'resync' is set or not + if (appConfig.getValueBool("resync")) { + // unset 'resync' now that everything has been performed + appConfig.setValueBool("resync" , false); + } } } -// PRocess any inotify events +// Process any inotify events void processInotifyEvents(bool updateFlag) { // Attempt to process or cancel inotify events // filesystemMonitor.update will throw this, thus needs to be caught