Removed Magic Numbers in propagator #5685 (#5705)
authorKaustubh Welankar <kaustubh.welankar@hotmail.com>
Thu, 20 Apr 2017 09:14:53 +0000 (14:44 +0530)
committerMarkus Goetz <markus@woboq.com>
Thu, 20 Apr 2017 09:14:53 +0000 (11:14 +0200)
src/libsync/owncloudpropagator.cpp
src/libsync/owncloudpropagator.h
src/libsync/propagatedownload.h
src/libsync/propagateupload.h

index 232984e048811e57e38386b88f00697342a78b4e..99e5ca0168287448378cba466ce2fdc01d66b593 100644 (file)
@@ -392,6 +392,12 @@ PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItemPtr &item) {
     return 0;
 }
 
+quint64 OwncloudPropagator::smallFileSize()
+{
+    const quint64 smallFileSize = 100*1024; //default to 1 MB. Not dynamic right now.
+    return smallFileSize;
+}
+
 void OwncloudPropagator::start(const SyncFileItemVector& items)
 {
     Q_ASSERT(std::is_sorted(items.begin(), items.end()));
index b2a57f7da0a970a11d1957955311cf1c2dacfacf..46110500041b91bfa749b8b4412ac4fdf5b10300 100644 (file)
@@ -327,6 +327,7 @@ public:
      * chunk-upload duration set.
      */
     quint64 _chunkSize;
+    quint64 smallFileSize();
 
     /* The maximum number of active jobs in parallel  */
     int hardMaximumActiveJob();
index 6553760cbd3d66e5c0212c8e418a7252f96a3322..437e7a5143998d7b3f3d55ba6ec49791bd77cc0e 100644 (file)
@@ -115,7 +115,7 @@ public:
     qint64 committedDiskSpace() const Q_DECL_OVERRIDE;
 
     // We think it might finish quickly because it is a small file.
-    bool isLikelyFinishedQuickly() Q_DECL_OVERRIDE { return _item->_size < 100*1024; }
+    bool isLikelyFinishedQuickly() Q_DECL_OVERRIDE { return _item->_size < propagator()->smallFileSize(); }
 
     /**
      * Whether an existing folder with the same name may be deleted before
index 969b6709a5c74a908df74e073096b830a680866d..bebd70dcebbcf1d5f85675aa869de895b39be530 100644 (file)
@@ -212,7 +212,7 @@ public:
 
     void start() Q_DECL_OVERRIDE;
 
-    bool isLikelyFinishedQuickly() Q_DECL_OVERRIDE { return _item->_size < 100*1024; }
+    bool isLikelyFinishedQuickly() Q_DECL_OVERRIDE { return _item->_size < propagator()->smallFileSize(); }
 
 private slots:
     void slotComputeContentChecksum();