From 3506c78afcfcf63d74d1b57b53518ea27dae2f8c Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 7 Mar 2017 14:56:03 +0100 Subject: Merge synchronization requests for individual mails of the same folder. We use this frequently when loading conversations, so this results in a significant preformance improvement. --- common/synchronizer.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'common/synchronizer.cpp') diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index b147615..fcdb5b8 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp @@ -252,15 +252,21 @@ void Synchronizer::modify(const DomainType &entity, const QByteArray &newResourc QList Synchronizer::getSyncRequests(const Sink::QueryBase &query) { - QList list; - list << Synchronizer::SyncRequest{query, "sync"}; - return list; + return QList() << Synchronizer::SyncRequest{query, "sync"}; +} + +void Synchronizer::mergeIntoQueue(const Synchronizer::SyncRequest &request, QList &queue) +{ + mSyncRequestQueue << request; } void Synchronizer::synchronize(const Sink::QueryBase &query) { SinkTraceCtx(mLogCtx) << "Synchronizing"; - mSyncRequestQueue << getSyncRequests(query); + auto newRequests = getSyncRequests(query); + for (const auto &request: newRequests) { + mergeIntoQueue(request, mSyncRequestQueue); + } processSyncQueue().exec(); } -- cgit v1.2.3