From 217d72486d55d313d9fda727fc5e2b06c0900de6 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Tue, 17 Dec 2019 05:32:38 +1100 Subject: [PATCH] Change synclist override flag to false as default when not using sync_list (#745) * Set 'syncListConfiguredOverride' to false by default, only set to true at start if sync_list is true * Remove logAndNotify as it is excessive for each change bundle to inform the desktop * Add a log entry when a monitor sync loop with OneDrive starts & completes --- src/main.d | 12 ++++++++++-- src/sync.d | 7 +++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main.d b/src/main.d index af2097a3..d4f8aede 100644 --- a/src/main.d +++ b/src/main.d @@ -690,15 +690,21 @@ int main(string[] args) auto logMonitorCounter = 0; auto fullScanCounter = 0; bool fullScanRequired = true; - bool syncListConfiguredOverride = true; + bool syncListConfiguredOverride = false; + // if sync list is configured, set to true + if (syncListConfigured) { + syncListConfiguredOverride = true; + } + while (true) { if (!cfg.getValueBool("download_only")) m.update(online); auto currTime = MonoTime.currTime(); if (currTime - lastCheckTime > checkInterval) { // log monitor output suppression logMonitorCounter += 1; - if (logMonitorCounter > logInterval) + if (logMonitorCounter > logInterval) { logMonitorCounter = 1; + } // full scan of sync_dir fullScanCounter += 1; @@ -727,6 +733,7 @@ int main(string[] args) } try { // perform a --monitor sync + log.vlog("Starting a sync with OneDrive"); performSync(sync, cfg.getValueString("single_directory"), cfg.getValueBool("download_only"), cfg.getValueBool("local_first"), cfg.getValueBool("upload_only"), (logMonitorCounter == logInterval ? MONITOR_LOG_QUIET : MONITOR_LOG_SILENT), fullScanRequired, syncListConfiguredOverride); if (!cfg.getValueBool("download_only")) { // discard all events that may have been generated by the sync @@ -743,6 +750,7 @@ int main(string[] args) log.log("Cannot initialize connection to OneDrive"); } // performSync complete, set lastCheckTime to current time + log.vlog("Sync with OneDrive is complete"); fullScanRequired = false; if (syncListConfigured) { syncListConfiguredOverride = false; diff --git a/src/sync.d b/src/sync.d index dfe1a285..eaa4c72d 100644 --- a/src/sync.d +++ b/src/sync.d @@ -852,8 +852,10 @@ final class SyncEngine if (!performFullItemScan){ // Display the number of changes we are processing + // OneDrive ships 'changes' in ~200 bundles. These messages then get displayed for each bundle if (nrChanges >= cfg.getValueLong("min_notify_changes")) { - log.logAndNotify("Processing ", nrChanges, " changes"); + // verbose log, no 'notify' .. it is over the top + log.vlog("Processing ", nrChanges, " changes"); } else { // There are valid changes log.vdebug("Number of changes from OneDrive to process: ", nrChanges); @@ -862,7 +864,8 @@ final class SyncEngine // Do not display anything unless we are doing a verbose debug as due to #658 we are essentially doing a --resync each time when using sync_list // Display the number of items we are processing if (nrChanges >= cfg.getValueLong("min_notify_changes")) { - log.logAndNotify("Processing ", nrChanges, " OneDrive items to ensure consistent state due to sync_list being used"); + // verbose log, no 'notify' .. it is over the top + log.vlog("Processing ", nrChanges, " OneDrive items to ensure consistent state due to sync_list being used"); } else { // There are valid changes log.vdebug("Number of items from OneDrive to process: ", nrChanges);