diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-07 14:56:03 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-07 14:56:03 +0100 |
commit | 3506c78afcfcf63d74d1b57b53518ea27dae2f8c (patch) | |
tree | da98a2f754e870d47316d8bf8b85dc84f4d62517 /common/synchronizer.cpp | |
parent | 4ecb10d3b1294d03578c28467c0f3759b3496e0b (diff) | |
download | sink-3506c78afcfcf63d74d1b57b53518ea27dae2f8c.tar.gz sink-3506c78afcfcf63d74d1b57b53518ea27dae2f8c.zip |
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.
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r-- | common/synchronizer.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
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 | |||
252 | 252 | ||
253 | QList<Synchronizer::SyncRequest> Synchronizer::getSyncRequests(const Sink::QueryBase &query) | 253 | QList<Synchronizer::SyncRequest> Synchronizer::getSyncRequests(const Sink::QueryBase &query) |
254 | { | 254 | { |
255 | QList<Synchronizer::SyncRequest> list; | 255 | return QList<Synchronizer::SyncRequest>() << Synchronizer::SyncRequest{query, "sync"}; |
256 | list << Synchronizer::SyncRequest{query, "sync"}; | 256 | } |
257 | return list; | 257 | |
258 | void Synchronizer::mergeIntoQueue(const Synchronizer::SyncRequest &request, QList<Synchronizer::SyncRequest> &queue) | ||
259 | { | ||
260 | mSyncRequestQueue << request; | ||
258 | } | 261 | } |
259 | 262 | ||
260 | void Synchronizer::synchronize(const Sink::QueryBase &query) | 263 | void Synchronizer::synchronize(const Sink::QueryBase &query) |
261 | { | 264 | { |
262 | SinkTraceCtx(mLogCtx) << "Synchronizing"; | 265 | SinkTraceCtx(mLogCtx) << "Synchronizing"; |
263 | mSyncRequestQueue << getSyncRequests(query); | 266 | auto newRequests = getSyncRequests(query); |
267 | for (const auto &request: newRequests) { | ||
268 | mergeIntoQueue(request, mSyncRequestQueue); | ||
269 | } | ||
264 | processSyncQueue().exec(); | 270 | processSyncQueue().exec(); |
265 | } | 271 | } |
266 | 272 | ||