Perform initial sync at startup in monitor mode (#946)

* If starting the application up, dont wait for monitor_interval to elapse before first sync attempt
This commit is contained in:
abraunegg 2020-06-05 06:49:23 +10:00 committed by GitHub
parent df361b261b
commit 203da2dfb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -858,7 +858,15 @@ int main(string[] args)
}
auto currTime = MonoTime.currTime();
if (currTime - lastCheckTime > checkInterval) {
// has monitor_interval elapsed or are we at application startup / monitor startup?
// in a --resync scenario, if we have not 're-populated' the database, valid changes will get skipped:
// Monitor directory: ./target
// Monitor directory: target/2eVPInOMTFNXzRXeNMEoJch5OR9XpGby
// [M] Item moved: random_files/2eVPInOMTFNXzRXeNMEoJch5OR9XpGby -> target/2eVPInOMTFNXzRXeNMEoJch5OR9XpGby
// Moving random_files/2eVPInOMTFNXzRXeNMEoJch5OR9XpGby to target/2eVPInOMTFNXzRXeNMEoJch5OR9XpGby
// Skipping uploading this new file as parent path is not in the database: target/2eVPInOMTFNXzRXeNMEoJch5OR9XpGby
// 'target' should be in the DB, it should also exist online, but because of --resync, it does not exist in the database thus parent check fails
if ((currTime - lastCheckTime > checkInterval) || (monitorLoopFullCount == 0)) {
// monitor sync loop
logOutputMessage = "################################################## NEW LOOP ##################################################";
if (displaySyncOptions) {