From: Christian Kamm Date: Wed, 12 Jul 2017 11:19:58 +0000 (+0200) Subject: SyncOptions/Propagator: Parallelism as an option X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~701^2~105 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=76faf4937b680e621ea5a9b420dba1b1a81fb5d6;p=nextcloud-desktop.git SyncOptions/Propagator: Parallelism as an option Very useful for changing it on a per-test basis. --- diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index 4404e76ea..4a09c3462 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -44,6 +44,7 @@ struct SyncOptions , _minChunkSize(1 * 1000 * 1000) // 1 MB , _maxChunkSize(100 * 1000 * 1000) // 100 MB , _targetChunkUploadDuration(60 * 1000) // 1 minute + , _parallelNetworkJobs(true) { } @@ -74,6 +75,9 @@ struct SyncOptions * Set to 0 it will disable dynamic chunk sizing. */ quint64 _targetChunkUploadDuration; + + /** Whether parallel network jobs are allowed. */ + bool _parallelNetworkJobs; }; diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index 65fd70264..7550838e7 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -80,7 +80,9 @@ OwncloudPropagator::~OwncloudPropagator() int OwncloudPropagator::maximumActiveTransferJob() { - if (_downloadLimit.fetchAndAddAcquire(0) != 0 || _uploadLimit.fetchAndAddAcquire(0) != 0) { + if (_downloadLimit.fetchAndAddAcquire(0) != 0 + || _uploadLimit.fetchAndAddAcquire(0) != 0 + || !_syncOptions._parallelNetworkJobs) { // disable parallelism when there is a network limit. return 1; } @@ -90,6 +92,8 @@ int OwncloudPropagator::maximumActiveTransferJob() /* The maximum number of active jobs in parallel */ int OwncloudPropagator::hardMaximumActiveJob() { + if (!_syncOptions._parallelNetworkJobs) + return 1; static int max = qgetenv("OWNCLOUD_MAX_PARALLEL").toUInt(); if (max) return max;