use a proper constant for the size of batch
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 25 Nov 2021 15:44:57 +0000 (16:44 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 26 Nov 2021 14:49:25 +0000 (15:49 +0100)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/bulkpropagatorjob.cpp

index 3aa8b76a2ee0c4109d2c0997e1664bc2b016f3d4..7c74a3ce9a923329da2bf0ca55234d2d9f500b16 100644 (file)
@@ -64,6 +64,8 @@ QByteArray getHeaderFromJsonReply(const QJsonObject &reply, const QByteArray &he
     return reply.value(headerName).toString().toLatin1();
 }
 
+constexpr auto batchSize = 100;
+
 }
 
 namespace OCC {
@@ -73,7 +75,8 @@ BulkPropagatorJob::BulkPropagatorJob(OwncloudPropagator *propagator,
     : PropagatorJob(propagator)
     , _items(items)
 {
-    _filesToUpload.reserve(100);
+    _filesToUpload.reserve(batchSize);
+    _pendingChecksumFiles.reserve(batchSize);
 }
 
 bool BulkPropagatorJob::scheduleSelfOrChild()
@@ -83,7 +86,7 @@ bool BulkPropagatorJob::scheduleSelfOrChild()
     }
 
     _state = Running;
-    for(int i = 0; i < 100 && !_items.empty(); ++i) {
+    for(int i = 0; i < batchSize && !_items.empty(); ++i) {
         auto currentItem = _items.front();
         _items.pop_front();
         _pendingChecksumFiles.insert(currentItem->_file);