From d2654f78a4f7e87b44e296477e4d90646c967670 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 28 Dec 2015 13:51:58 +0100 Subject: Only hardcode once if we have to --- common/genericresource.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'common/genericresource.cpp') diff --git a/common/genericresource.cpp b/common/genericresource.cpp index afe3900..a6213d7 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp @@ -10,6 +10,8 @@ #include "log.h" #include "definitions.h" +static int sBatchSize = 100; + using namespace Akonadi2; /** @@ -206,8 +208,7 @@ private slots: }).then(KAsync::dowhile( [queue]() { return !queue->isEmpty(); }, [this, queue](KAsync::Future &future) { - const int batchSize = 100; - queue->dequeueBatch(batchSize, [this](const QByteArray &data) { + queue->dequeueBatch(sBatchSize, [this](const QByteArray &data) { return KAsync::start([this, data](KAsync::Future &future) { processQueuedCommand(data).then([&future, this](qint64 createdRevision) { Trace() << "Created revision " << createdRevision; @@ -357,11 +358,10 @@ void GenericResource::enqueueCommand(MessageQueue &mq, int commandId, const QByt void GenericResource::processCommand(int commandId, const QByteArray &data) { static int modifications = 0; - const int batchSize = 100; mUserQueue.startTransaction(); enqueueCommand(mUserQueue, commandId, data); modifications++; - if (modifications >= batchSize) { + if (modifications >= sBatchSize) { mUserQueue.commit(); modifications = 0; mCommitQueueTimer.stop(); -- cgit v1.2.3