[Pkg-owncloud-commits] [owncloud-client] 26/78: Upload: put the job in the active list while doing the checksum computation.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Fri Jun 24 16:29:39 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 03e3b3bf50e7e10a41ff28d8a27c8bec1be45065
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Fri May 20 15:06:07 2016 +0200
Upload: put the job in the active list while doing the checksum computation.
This fixes an issue in which too many jobs are started un parallel
while uploading many files, which could cause too much memory usage as the
chunks are stored in memory.
Probably the fix for #4611
---
src/libsync/owncloudpropagator.h | 7 ++++++-
src/libsync/propagateupload.cpp | 6 ++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h
index 85fa426..6dcfd56 100644
--- a/src/libsync/owncloudpropagator.h
+++ b/src/libsync/owncloudpropagator.h
@@ -297,7 +297,12 @@ public:
QAtomicInt _abortRequested; // boolean set by the main thread to abort.
- /* The list of currently active jobs */
+ /** The list of currently active jobs.
+ This list contains the jobs that are currently using ressources and is used purely to
+ know how many jobs there is currently running for the scheduler.
+ Jobs add themself to the list when they do an assynchronous operation.
+ Jobs can be several time on the list (example, when several chunks are uploaded in parallel)
+ */
QList<PropagateItemJob*> _activeJobList;
/** We detected that another sync is required after this one */
diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp
index bd2f29b..9f98331 100644
--- a/src/libsync/propagateupload.cpp
+++ b/src/libsync/propagateupload.cpp
@@ -209,8 +209,6 @@ void PropagateUploadFileQNAM::slotComputeContentChecksum()
return;
}
- _propagator->_activeJobList.removeOne(this);
-
const QString filePath = _propagator->getFilePath(_item->_file);
// remember the modtime before checksumming to be able to detect a file
@@ -274,6 +272,10 @@ void PropagateUploadFileQNAM::slotComputeTransmissionChecksum(const QByteArray&
void PropagateUploadFileQNAM::slotStartUpload(const QByteArray& transmissionChecksumType, const QByteArray& transmissionChecksum)
{
+ // Remove ourselfs from the list of active job, before any posible call to done()
+ // When we start chunks, we will add it again, once for every chunks.
+ _propagator->_activeJobList.removeOne(this);
+
_transmissionChecksum = transmissionChecksum;
_transmissionChecksumType = transmissionChecksumType;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list