Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
Piotr M 5c3fd36f28 tests 2017-01-16 12:34:07 +01:00
3 arquivos alterados com 12 adições e 6 exclusões
+1
Ver Arquivo
@@ -329,6 +329,7 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
// TODO: here we should also check somehow if bundle is not blacklisted
bool enableBundledRequests = _account->bundledRequestsEnabled() && !this->hasNetworkLimit();
//bool enableBundledRequests = false;
foreach(const SyncFileItemPtr &item, items) {
+8 -3
Ver Arquivo
@@ -136,10 +136,13 @@ void PropagateBundle::slotStartUpload(const QByteArray& transmissionChecksumType
if (!_itemsToChecksum.empty()){
SyncFileItemPtr nextItem = _itemsToChecksum.first();
// Ensure that we always send at least 1/6 of total files to sync, to avoid situation that all files fit into 1 request (no parallelism)
quint64 bundleLimits = qMin(checkBundledRequestsLimits(), (_totalFiles/_propagator->hardMaximumActiveJob()));
// if next item will exceed bundle size, send the bundle now
// otherwise, compute next checksum
if (((_currentBundleSize + nextItem->_size) >= chunkSize())
|| (_currentRequestsNumber >= checkBundledRequestsLimits())){
|| (_currentRequestsNumber >= bundleLimits)){
_currentBundleSize = 0;
_currentRequestsNumber = 0;
startBundle();
@@ -260,8 +263,9 @@ void PropagateBundle::startBundle()
// we have finished preparing bundles to send, allow other bundles to be send
_preparingBundle = false;
// check if there are any items to be bundled and if you can run another parallel job
if (!_itemsToChecksum.empty() && (_propagator->_activeJobList.count() < _propagator->maximumActiveJob())) {
// Check if there are any items to be bundled and if you can run another parallel job
// Parallelisze to hardMaximumActiveJob() since it is the same as in upload.h -> isLikelyFinishedQuickly for small files
if (!_itemsToChecksum.empty() && (_propagator->_activeJobList.count() < _propagator->hardMaximumActiveJob())) {
start();
}
} else {
@@ -275,6 +279,7 @@ QByteArray PropagateBundle::getRemotePath(QString filePath){
}
void PropagateBundle::append(const SyncFileItemPtr &bundledFile){
_totalFiles++;
_size += bundledFile->_size;
_itemsToChecksum.append(bundledFile);
}
+3 -3
Ver Arquivo
@@ -103,7 +103,7 @@ private:
public:
PropagateBundle(OwncloudPropagator* propagator)
: PropagateItemJob(propagator, SyncFileItemPtr(new SyncFileItem)), _preparingBundle(true), _size(0), _currentBundleSize(0), _currentRequestsNumber(0) {}
: PropagateItemJob(propagator, SyncFileItemPtr(new SyncFileItem)), _preparingBundle(true), _size(0), _currentBundleSize(0), _currentRequestsNumber(0), _totalFiles(0) {}
void start() Q_DECL_OVERRIDE;
void startBundle();
void append(const SyncFileItemPtr &bundledFile);
@@ -130,8 +130,8 @@ private:
quint64 checkBundledRequestsLimits()
{
//TODO: obtain this value from the server or by other means
quint64 maximumBundledFiles = 500;
return (maximumBundledFiles/_propagator->maximumActiveJob());
quint64 maximumBundledFiles = 100;
return maximumBundledFiles;
}
quint64 chunkSize() const { return _propagator->chunkSize(); }
int getHttpStatusCode(const QString &status);