mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 05:45:42 +03:00
FolderMan: Require 2s minimum delay.
Otherwise we run into "can't upload because it's too recent" issues when the folder watcher triggers a sync. We used to do this, but my recent refactoring started counting the time since the last sync against this minimum delay, leading to 1ms delays in practice. This fixes the regression.
This commit is contained in:
parent
2c432e0b97
commit
f59515883d
1 changed files with 6 additions and 4 deletions
|
@ -564,16 +564,18 @@ void FolderMan::startScheduledSyncSoon(qint64 msMinimumDelay)
|
|||
}
|
||||
}
|
||||
|
||||
// A minimum of delay here is essential as the sync will not upload
|
||||
// files that were changed too recently.
|
||||
msDelay = qMax(msDelay, msBetweenRequestAndSync);
|
||||
|
||||
// Delays beyond one minute seem too big, particularly since there
|
||||
// could be things later in the queue that shouldn't be punished by a
|
||||
// long delay!
|
||||
msDelay = qMin(msDelay, 60*1000ll);
|
||||
|
||||
// Time since the last sync run counts against the delay
|
||||
msDelay = qMax(1ll, msDelay - msSinceLastSync);
|
||||
|
||||
// A minimum of delay here is essential as the sync will not upload
|
||||
// files that were changed too recently.
|
||||
msDelay = qMax(msBetweenRequestAndSync, msDelay);
|
||||
|
||||
qDebug() << "Scheduling a sync in" << (msDelay/1000) << "seconds";
|
||||
_startScheduledSyncTimer.start(msDelay);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue