mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-23 16:12:12 +02:00
Remove double scan of OneDrive when using --monitor --resync at application startup (#920)
* Remove double scan of OneDrive when using --monitor --resync at application startup
This commit is contained in:
parent
206ab8f516
commit
060a42ab77
20
src/main.d
20
src/main.d
|
@ -724,10 +724,10 @@ int main(string[] args)
|
||||||
sync.queryDriveForChanges(remotePath);
|
sync.queryDriveForChanges(remotePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are we performing a sync, resync or monitor operation?
|
// Are we performing a sync, or monitor operation?
|
||||||
if ((cfg.getValueBool("synchronize")) || (cfg.getValueBool("resync")) || (cfg.getValueBool("monitor"))) {
|
if ((cfg.getValueBool("synchronize")) || (cfg.getValueBool("monitor"))) {
|
||||||
|
|
||||||
if ((cfg.getValueBool("synchronize")) || (cfg.getValueBool("resync"))) {
|
if (cfg.getValueBool("synchronize")) {
|
||||||
if (online) {
|
if (online) {
|
||||||
// Check user entry for local path - the above chdir means we are already in ~/OneDrive/ thus singleDirectory is local to this path
|
// Check user entry for local path - the above chdir means we are already in ~/OneDrive/ thus singleDirectory is local to this path
|
||||||
if (cfg.getValueString("single_directory") != ""){
|
if (cfg.getValueString("single_directory") != ""){
|
||||||
|
@ -830,7 +830,8 @@ int main(string[] args)
|
||||||
MonoTime lastCheckTime = MonoTime.currTime();
|
MonoTime lastCheckTime = MonoTime.currTime();
|
||||||
long logMonitorCounter = 0;
|
long logMonitorCounter = 0;
|
||||||
long fullScanCounter = 0;
|
long fullScanCounter = 0;
|
||||||
bool fullScanRequired = false;
|
// set fullScanRequired to true so that at application startup we perform a full walk
|
||||||
|
bool fullScanRequired = true;
|
||||||
bool syncListConfiguredFullScanOverride = false;
|
bool syncListConfiguredFullScanOverride = false;
|
||||||
// if sync list is configured, set to true
|
// if sync list is configured, set to true
|
||||||
if (syncListConfigured) {
|
if (syncListConfigured) {
|
||||||
|
@ -850,13 +851,15 @@ int main(string[] args)
|
||||||
|
|
||||||
auto currTime = MonoTime.currTime();
|
auto currTime = MonoTime.currTime();
|
||||||
if (currTime - lastCheckTime > checkInterval) {
|
if (currTime - lastCheckTime > checkInterval) {
|
||||||
|
// monitor sync loop
|
||||||
|
log.vdebug("################################################## NEW LOOP ##################################################");
|
||||||
// Increment monitorLoopFullCount
|
// Increment monitorLoopFullCount
|
||||||
monitorLoopFullCount++;
|
monitorLoopFullCount++;
|
||||||
// Display memory details at start of loop
|
// Display memory details at start of loop
|
||||||
if (displayMemoryUsage) {
|
if (displayMemoryUsage) {
|
||||||
log.displayMemoryUsagePreGC();
|
log.displayMemoryUsagePreGC();
|
||||||
}
|
}
|
||||||
|
|
||||||
// log monitor output suppression
|
// log monitor output suppression
|
||||||
logMonitorCounter += 1;
|
logMonitorCounter += 1;
|
||||||
if (logMonitorCounter > logInterval) {
|
if (logMonitorCounter > logInterval) {
|
||||||
|
@ -868,10 +871,14 @@ int main(string[] args)
|
||||||
if (fullScanCounter > fullScanFrequency){
|
if (fullScanCounter > fullScanFrequency){
|
||||||
// loop counter has exceeded
|
// loop counter has exceeded
|
||||||
fullScanCounter = 1;
|
fullScanCounter = 1;
|
||||||
fullScanRequired = true;
|
|
||||||
if (syncListConfigured) {
|
if (syncListConfigured) {
|
||||||
|
// set fullScanRequired = true due to sync_list being used
|
||||||
|
fullScanRequired = true;
|
||||||
// sync list is configured
|
// sync list is configured
|
||||||
syncListConfiguredFullScanOverride = true;
|
syncListConfiguredFullScanOverride = true;
|
||||||
|
} else {
|
||||||
|
// dont set fullScanRequired to true as this is excessive if sync_list is not being used
|
||||||
|
fullScanRequired = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,6 +1011,7 @@ void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, boo
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
|
log.vdebug("################################################## NEW SYNC ##################################################");
|
||||||
if (singleDirectory != ""){
|
if (singleDirectory != ""){
|
||||||
// we were requested to sync a single directory
|
// we were requested to sync a single directory
|
||||||
log.vlog("Syncing changes from this selected path: ", singleDirectory);
|
log.vlog("Syncing changes from this selected path: ", singleDirectory);
|
||||||
|
|
Loading…
Reference in a new issue