From 3acdfc0004f91bf43dd681a745fa3cd40875c13e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 28 Mar 2014 11:20:07 +0100 Subject: [PATCH] Make configurable the maximum amount of job in parallel Bia the environement variable OWNCLOUD_MAX_PARALLEL --- src/mirall/owncloudpropagator.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp index d0402d4bb5..e8cb6180f1 100644 --- a/src/mirall/owncloudpropagator.cpp +++ b/src/mirall/owncloudpropagator.cpp @@ -25,7 +25,13 @@ namespace Mirall { /* The maximum number of active job in parallel */ -static const int maximumActiveJob = 3; +static int maximumActiveJob() { + static int max = qgetenv("OWNCLOUD_MAX_PARALLEL").toUInt(); + if (!max) { + max = 3; //default + } + return max; +} void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorString) { @@ -288,7 +294,7 @@ void PropagateDirectory::slotSubJobReady() return; // Ignore the case when the _fistJob is ready and not yet finished if (_runningNow && _current >= 0 && _current < _subJobs.count()) { // there is a job running and the current one is not ready yet, we can't start new job - if (!_subJobs[_current]->_readySent || _propagator->_activeJobs >= maximumActiveJob) + if (!_subJobs[_current]->_readySent || _propagator->_activeJobs >= maximumActiveJob()) return; }