From 7daeec83233c522980d5e477fee82045de57f77d Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 12 Jan 2017 11:45:15 +0100 Subject: syncThen is no longer necessary --- common/changereplay.cpp | 2 +- common/commandprocessor.cpp | 12 ++++++------ common/messagequeue.cpp | 2 +- common/pipeline.cpp | 2 +- common/queryrunner.cpp | 4 ++-- common/resourcecontrol.cpp | 4 ++-- common/store.cpp | 2 +- common/synchronizer.cpp | 8 ++++---- 8 files changed, 18 insertions(+), 18 deletions(-) (limited to 'common') diff --git a/common/changereplay.cpp b/common/changereplay.cpp index 5d5afbb..224fb25 100644 --- a/common/changereplay.cpp +++ b/common/changereplay.cpp @@ -151,7 +151,7 @@ KAsync::Job ChangeReplay::replayNextRevision() return KAsync::value(KAsync::Break); }); })) - .syncThen([this, lastReplayedRevision]() { + .then([this, lastReplayedRevision]() { recordReplayedRevision(*lastReplayedRevision); mMainStoreTransaction.abort(); if (ChangeReplay::allChangesReplayed()) { diff --git a/common/commandprocessor.cpp b/common/commandprocessor.cpp index 7cd4a5f..87a120b 100644 --- a/common/commandprocessor.cpp +++ b/common/commandprocessor.cpp @@ -169,7 +169,7 @@ void CommandProcessor::process() } mProcessingLock = true; auto job = processPipeline() - .syncThen([this]() { + .then([this]() { mProcessingLock = false; if (messagesToProcessAvailable()) { process(); @@ -193,10 +193,10 @@ KAsync::Job CommandProcessor::processQueuedCommand(const Sink::QueuedCom case Sink::Commands::InspectionCommand: Q_ASSERT(mInspector); return mInspector->processCommand(data, size) - .syncThen([]() { return -1; }); + .then(KAsync::value(-1)); case Sink::Commands::FlushCommand: return flush(data, size) - .syncThen([]() { return -1; }); + .then(KAsync::value(-1)); default: return KAsync::error(-1, "Unhandled command"); } @@ -234,7 +234,7 @@ KAsync::Job CommandProcessor::processQueue(MessageQueue *queue) [this, time](const QByteArray &data) -> KAsync::Job { time->start(); return processQueuedCommand(data) - .syncThen([this, time](qint64 createdRevision) { + .then([this, time](qint64 createdRevision) { SinkTraceCtx(mLogCtx) << "Created revision " << createdRevision << ". Processing took: " << Log::TraceTime(time->elapsed()); }); }) @@ -251,7 +251,7 @@ KAsync::Job CommandProcessor::processQueue(MessageQueue *queue) } }); })) - .syncThen([this](const KAsync::Error &) { mPipeline->commit(); }); + .then([this](const KAsync::Error &) { mPipeline->commit(); }); } KAsync::Job CommandProcessor::processPipeline() @@ -273,7 +273,7 @@ KAsync::Job CommandProcessor::processPipeline() auto queue = it->next(); return processQueue(queue) - .syncThen([this, time, it]() { + .then([this, time, it]() { SinkTraceCtx(mLogCtx) << "Queue processed." << Log::TraceTime(time->elapsed()); if (it->hasNext()) { return KAsync::Continue; diff --git a/common/messagequeue.cpp b/common/messagequeue.cpp index 0fcbf99..6e79d89 100644 --- a/common/messagequeue.cpp +++ b/common/messagequeue.cpp @@ -108,7 +108,7 @@ KAsync::Job MessageQueue::dequeueBatch(int maxBatchSize, const std::functi // Trace() << "Waiting on " << waitCondition.size() << " results"; KAsync::waitForCompletion(waitCondition) - .syncThen([this, resultCount, &future]() { + .then([this, resultCount, &future]() { processRemovals(); if (*resultCount == 0) { future.setFinished(); diff --git a/common/pipeline.cpp b/common/pipeline.cpp index 4cb5f21..32f6454 100644 --- a/common/pipeline.cpp +++ b/common/pipeline.cpp @@ -279,7 +279,7 @@ KAsync::Job Pipeline::modifiedEntity(void const *command, size_t size) SinkTraceCtx(d->logCtx) << "Moving entity to new resource " << newEntity.identifier() << newEntity.resourceInstanceIdentifier() << targetResource; auto job = TypeHelper{bufferType}.operator(), ApplicationDomain::ApplicationDomainType&>(newEntity); - job = job.syncThen([this, current, isMove, targetResource, bufferType](const KAsync::Error &error) { + job = job.then([this, current, isMove, targetResource, bufferType](const KAsync::Error &error) { if (!error) { SinkTraceCtx(d->logCtx) << "Move of " << current.identifier() << "was successfull"; if (isMove) { diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp index f1e21f4..6730894 100644 --- a/common/queryrunner.cpp +++ b/common/queryrunner.cpp @@ -94,7 +94,7 @@ QueryRunner::QueryRunner(const Sink::Query &query, const Sink::Resou const auto newRevisionAndReplayedEntities = worker.executeInitialQuery(query, parent, *resultProvider, offset, batchSize); return newRevisionAndReplayedEntities; }) - .template syncThen([this, parentId, query, parent, resultProvider, guardPtr](const ReplayResult &newRevisionAndReplayedEntities) { + .template then([this, parentId, query, parent, resultProvider, guardPtr](const ReplayResult &newRevisionAndReplayedEntities) { if (!guardPtr) { qWarning() << "The parent object is already gone"; return; @@ -124,7 +124,7 @@ QueryRunner::QueryRunner(const Sink::Query &query, const Sink::Resou const auto newRevisionAndReplayedEntities = worker.executeIncrementalQuery(query, *resultProvider); return newRevisionAndReplayedEntities; }) - .template syncThen([query, this, resultProvider, guardPtr](const ReplayResult &newRevisionAndReplayedEntities) { + .template then([query, this, resultProvider, guardPtr](const ReplayResult &newRevisionAndReplayedEntities) { if (!guardPtr) { qWarning() << "The parent object is already gone"; return; diff --git a/common/resourcecontrol.cpp b/common/resourcecontrol.cpp index c1fbf06..b24c902 100644 --- a/common/resourcecontrol.cpp +++ b/common/resourcecontrol.cpp @@ -64,7 +64,7 @@ KAsync::Job ResourceControl::shutdown(const QByteArray &identifier) future.setFinished(); } }); - }).syncThen([time] { + }).then([time] { SinkTrace() << "Shutdown complete." << Log::TraceTime(time->elapsed()); }); }); @@ -77,7 +77,7 @@ KAsync::Job ResourceControl::start(const QByteArray &identifier) time->start(); auto resourceAccess = ResourceAccessFactory::instance().getAccess(identifier, ResourceConfig::getResourceType(identifier)); resourceAccess->open(); - return resourceAccess->sendCommand(Sink::Commands::PingCommand).addToContext(resourceAccess).syncThen([time]() { SinkTrace() << "Start complete." << Log::TraceTime(time->elapsed()); }); + return resourceAccess->sendCommand(Sink::Commands::PingCommand).addToContext(resourceAccess).then([time]() { SinkTrace() << "Start complete." << Log::TraceTime(time->elapsed()); }); } KAsync::Job ResourceControl::flushMessageQueue(const QByteArrayList &resourceIdentifier) diff --git a/common/store.cpp b/common/store.cpp index 38445e5..b4ef2b7 100644 --- a/common/store.cpp +++ b/common/store.cpp @@ -263,7 +263,7 @@ KAsync::Job Store::removeDataFromDisk(const QByteArray &identifier) future.setFinished(); } }) - .syncThen([time]() { + .then([time]() { SinkTrace() << "Remove from disk complete." << Log::TraceTime(time->elapsed()); }); } diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index a4e64c9..bb1a3f4 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp @@ -286,7 +286,7 @@ KAsync::Job Synchronizer::processSyncQueue() while (!mSyncRequestQueue.isEmpty()) { auto request = mSyncRequestQueue.takeFirst(); if (request.requestType == Synchronizer::SyncRequest::Synchronization) { - job = job.syncThen([this, request] { + job = job.then([this, request] { Sink::Notification n; n.id = request.requestId; n.type = Notification::Status; @@ -294,7 +294,7 @@ KAsync::Job Synchronizer::processSyncQueue() n.code = ApplicationDomain::BusyStatus; emit notify(n); SinkLogCtx(mLogCtx) << "Synchronizing " << request.query; - }).then(synchronizeWithSource(request.query)).syncThen([this] { + }).then(synchronizeWithSource(request.query)).then([this] { //Commit after every request, so implementations only have to commit more if they add a lot of data. commit(); }).then([this, request](const KAsync::Error &error) { @@ -431,7 +431,7 @@ KAsync::Job Synchronizer::replay(const QByteArray &type, const QByteArray job = replay(mail, operation, oldRemoteId, modifiedProperties); } - return job.syncThen([this, operation, type, uid, oldRemoteId](const QByteArray &remoteId) { + return job.then([this, operation, type, uid, oldRemoteId](const QByteArray &remoteId) { if (operation == Sink::Operation_Creation) { SinkTrace() << "Replayed creation with remote id: " << remoteId; if (remoteId.isEmpty()) { @@ -453,7 +453,7 @@ KAsync::Job Synchronizer::replay(const QByteArray &type, const QByteArray SinkError() << "Unkown operation" << operation; } }) - .syncThen([this](const KAsync::Error &error) { + .then([this](const KAsync::Error &error) { if (error) { SinkWarning() << "Failed to replay change: " << error.errorMessage; } -- cgit v1.2.3