mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Propagator: Make sure we schedule only one job #7439
To not starve the event loop. (There is still ~= 3 jobs running at the same time)
This commit is contained in:
parent
3446412d92
commit
475117dd60
2 changed files with 6 additions and 0 deletions
|
@ -487,6 +487,7 @@ void OwncloudPropagator::start(const SyncFileItemVector &items)
|
|||
|
||||
connect(_rootJob.data(), &PropagatorJob::finished, this, &OwncloudPropagator::emitFinished);
|
||||
|
||||
_jobScheduled = false;
|
||||
scheduleNextJob();
|
||||
}
|
||||
|
||||
|
@ -587,6 +588,8 @@ QString OwncloudPropagator::getFilePath(const QString &tmp_file_name) const
|
|||
|
||||
void OwncloudPropagator::scheduleNextJob()
|
||||
{
|
||||
if (_jobScheduled) return; // don't schedule more than 1
|
||||
_jobScheduled = true;
|
||||
QTimer::singleShot(0, this, &OwncloudPropagator::scheduleNextJobImpl);
|
||||
}
|
||||
|
||||
|
@ -597,6 +600,8 @@ void OwncloudPropagator::scheduleNextJobImpl()
|
|||
// Down-scaling on slow networks? https://github.com/owncloud/client/issues/3382
|
||||
// Making sure we do up/down at same time? https://github.com/owncloud/client/issues/1633
|
||||
|
||||
_jobScheduled = false;
|
||||
|
||||
if (_activeJobList.count() < maximumActiveTransferJob()) {
|
||||
if (_rootJob->scheduleSelfOrChild()) {
|
||||
scheduleNextJob();
|
||||
|
|
|
@ -567,6 +567,7 @@ private:
|
|||
AccountPtr _account;
|
||||
QScopedPointer<PropagateDirectory> _rootJob;
|
||||
SyncOptions _syncOptions;
|
||||
bool _jobScheduled = false;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue