mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-01 21:42:16 +02:00
Update monitor mode logic
* Update where lastCheckTime is set - after the sync, not before * Add in log to advise what the monitor sync interval is set to
This commit is contained in:
parent
f385a0e24a
commit
7a864a2b4c
|
@ -261,6 +261,7 @@ int main(string[] args)
|
|||
|
||||
if (monitor) {
|
||||
log.vlog("Initializing monitor ...");
|
||||
log.vlog("OneDrive monitor interval (seconds): ", to!long(cfg.getValue("monitor_interval")));
|
||||
Monitor m = new Monitor(selectiveSync);
|
||||
m.onDirCreated = delegate(string path) {
|
||||
log.vlog("[M] Directory created: ", path);
|
||||
|
@ -302,7 +303,6 @@ int main(string[] args)
|
|||
if (!downloadOnly) m.update(online);
|
||||
auto currTime = MonoTime.currTime();
|
||||
if (currTime - lastCheckTime > checkInterval) {
|
||||
lastCheckTime = currTime;
|
||||
online = testNetwork();
|
||||
if (online) {
|
||||
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly);
|
||||
|
@ -311,19 +311,19 @@ int main(string[] args)
|
|||
m.update(false);
|
||||
}
|
||||
}
|
||||
// performSync complete, set lastCheckTime to current time
|
||||
lastCheckTime = currTime;
|
||||
GC.collect();
|
||||
} else {
|
||||
Thread.sleep(dur!"msecs"(100));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// workaround for segfault in std.net.curl.Curl.shutdown() on exit
|
||||
onedrive.http.shutdown();
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
// try to synchronize the folder three times
|
||||
|
|
Loading…
Reference in a new issue