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
This commit is contained in:
abraunegg 2019-12-17 05:32:38 +11:00 committed by GitHub
parent aaa26a4e7e
commit 217d72486d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View file

@ -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;

View file

@ -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);