diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-25 11:23:08 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-25 11:23:08 +0100 |
commit | 3fc8ce958fc244e64a3a3a92f3b1440aae04133b (patch) | |
tree | 4ba2b3ca3ee6a17e7f3e7ce67d6ca934626cad7a /dummyresource/facade.cpp | |
parent | 9b744da32e64d8a6cd342faba8fc3232884d60f2 (diff) | |
download | sink-3fc8ce958fc244e64a3a3a92f3b1440aae04133b.tar.gz sink-3fc8ce958fc244e64a3a3a92f3b1440aae04133b.zip |
A way to ensure all messages have been processed.
As queries become reactive this should become less important. We can then just wait until
all results become available. For tests it is in either case useful though.
Diffstat (limited to 'dummyresource/facade.cpp')
-rw-r--r-- | dummyresource/facade.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index 1aaec68..fcce871 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp | |||
@@ -115,16 +115,16 @@ static std::function<bool(const std::string &key, DummyEvent const *buffer, Akon | |||
115 | return preparedQuery; | 115 | return preparedQuery; |
116 | } | 116 | } |
117 | 117 | ||
118 | Async::Job<void> DummyResourceFacade::synchronizeResource(bool sync) | 118 | Async::Job<void> DummyResourceFacade::synchronizeResource(bool sync, bool processAll) |
119 | { | 119 | { |
120 | //TODO check if a sync is necessary | 120 | //TODO check if a sync is necessary |
121 | //TODO Only sync what was requested | 121 | //TODO Only sync what was requested |
122 | //TODO timeout | 122 | //TODO timeout |
123 | 123 | ||
124 | if (sync) { | 124 | if (sync || processAll) { |
125 | return Async::start<void>([=](Async::Future<void> &future) { | 125 | return Async::start<void>([=](Async::Future<void> &future) { |
126 | mResourceAccess->open(); | 126 | mResourceAccess->open(); |
127 | mResourceAccess->synchronizeResource().then<void>([&future](Async::Future<void> &f) { | 127 | mResourceAccess->synchronizeResource(sync, processAll).then<void>([&future](Async::Future<void> &f) { |
128 | future.setFinished(); | 128 | future.setFinished(); |
129 | f.setFinished(); | 129 | f.setFinished(); |
130 | }).exec(); | 130 | }).exec(); |
@@ -195,7 +195,7 @@ void DummyResourceFacade::readValue(QSharedPointer<Akonadi2::Storage> storage, c | |||
195 | 195 | ||
196 | Async::Job<void> DummyResourceFacade::load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::Domain::Event::Ptr &)> &resultCallback) | 196 | Async::Job<void> DummyResourceFacade::load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::Domain::Event::Ptr &)> &resultCallback) |
197 | { | 197 | { |
198 | return synchronizeResource(query.syncOnDemand).then<void>([=](Async::Future<void> &future) { | 198 | return synchronizeResource(query.syncOnDemand, query.processAll).then<void>([=](Async::Future<void> &future) { |
199 | //Now that the sync is complete we can execute the query | 199 | //Now that the sync is complete we can execute the query |
200 | const auto preparedQuery = prepareQuery(query); | 200 | const auto preparedQuery = prepareQuery(query); |
201 | 201 | ||