diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/synchronizer.cpp | 14 | ||||
-rw-r--r-- | common/synchronizer.h | 5 |
2 files changed, 15 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 | ||
diff --git a/common/synchronizer.h b/common/synchronizer.h index 120a8a5..af042cb 100644 --- a/common/synchronizer.h +++ b/common/synchronizer.h | |||
@@ -175,6 +175,11 @@ protected: | |||
175 | */ | 175 | */ |
176 | virtual QList<Synchronizer::SyncRequest> getSyncRequests(const Sink::QueryBase &query); | 176 | virtual QList<Synchronizer::SyncRequest> getSyncRequests(const Sink::QueryBase &query); |
177 | 177 | ||
178 | /** | ||
179 | * This allows the synchronizer to merge new requests with existing requests in the queue. | ||
180 | */ | ||
181 | virtual void mergeIntoQueue(const Synchronizer::SyncRequest &request, QList<Synchronizer::SyncRequest> &queue); | ||
182 | |||
178 | protected: | 183 | protected: |
179 | Sink::Log::Context mLogCtx; | 184 | Sink::Log::Context mLogCtx; |
180 | private: | 185 | private: |