mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-04 23:12:18 +02:00
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:
parent
aaa26a4e7e
commit
217d72486d
12
src/main.d
12
src/main.d
|
@ -690,15 +690,21 @@ int main(string[] args)
|
||||||
auto logMonitorCounter = 0;
|
auto logMonitorCounter = 0;
|
||||||
auto fullScanCounter = 0;
|
auto fullScanCounter = 0;
|
||||||
bool fullScanRequired = true;
|
bool fullScanRequired = true;
|
||||||
bool syncListConfiguredOverride = true;
|
bool syncListConfiguredOverride = false;
|
||||||
|
// if sync list is configured, set to true
|
||||||
|
if (syncListConfigured) {
|
||||||
|
syncListConfiguredOverride = true;
|
||||||
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!cfg.getValueBool("download_only")) m.update(online);
|
if (!cfg.getValueBool("download_only")) m.update(online);
|
||||||
auto currTime = MonoTime.currTime();
|
auto currTime = MonoTime.currTime();
|
||||||
if (currTime - lastCheckTime > checkInterval) {
|
if (currTime - lastCheckTime > checkInterval) {
|
||||||
// log monitor output suppression
|
// log monitor output suppression
|
||||||
logMonitorCounter += 1;
|
logMonitorCounter += 1;
|
||||||
if (logMonitorCounter > logInterval)
|
if (logMonitorCounter > logInterval) {
|
||||||
logMonitorCounter = 1;
|
logMonitorCounter = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// full scan of sync_dir
|
// full scan of sync_dir
|
||||||
fullScanCounter += 1;
|
fullScanCounter += 1;
|
||||||
|
@ -727,6 +733,7 @@ int main(string[] args)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// perform a --monitor sync
|
// 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);
|
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")) {
|
if (!cfg.getValueBool("download_only")) {
|
||||||
// discard all events that may have been generated by the sync
|
// 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");
|
log.log("Cannot initialize connection to OneDrive");
|
||||||
}
|
}
|
||||||
// performSync complete, set lastCheckTime to current time
|
// performSync complete, set lastCheckTime to current time
|
||||||
|
log.vlog("Sync with OneDrive is complete");
|
||||||
fullScanRequired = false;
|
fullScanRequired = false;
|
||||||
if (syncListConfigured) {
|
if (syncListConfigured) {
|
||||||
syncListConfiguredOverride = false;
|
syncListConfiguredOverride = false;
|
||||||
|
|
|
@ -852,8 +852,10 @@ final class SyncEngine
|
||||||
|
|
||||||
if (!performFullItemScan){
|
if (!performFullItemScan){
|
||||||
// Display the number of changes we are processing
|
// 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")) {
|
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 {
|
} else {
|
||||||
// There are valid changes
|
// There are valid changes
|
||||||
log.vdebug("Number of changes from OneDrive to process: ", nrChanges);
|
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
|
// 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
|
// Display the number of items we are processing
|
||||||
if (nrChanges >= cfg.getValueLong("min_notify_changes")) {
|
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 {
|
} else {
|
||||||
// There are valid changes
|
// There are valid changes
|
||||||
log.vdebug("Number of items from OneDrive to process: ", nrChanges);
|
log.vdebug("Number of items from OneDrive to process: ", nrChanges);
|
||||||
|
|
Loading…
Reference in a new issue