summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/messagequeue.cpp12
-rw-r--r--common/pipeline.cpp3
2 files changed, 12 insertions, 3 deletions
diff --git a/common/messagequeue.cpp b/common/messagequeue.cpp
index add4759..ccb5362 100644
--- a/common/messagequeue.cpp
+++ b/common/messagequeue.cpp
@@ -23,15 +23,18 @@ void MessageQueue::dequeue(const std::function<void(void *ptr, int size, std::fu
23 const std::function<void(const Error &error)> &errorHandler) 23 const std::function<void(const Error &error)> &errorHandler)
24{ 24{
25 bool readValue = false; 25 bool readValue = false;
26 mStorage.scan("", [this, resultHandler, &readValue](void *keyPtr, int keySize, void *valuePtr, int valueSize) -> bool { 26 mStorage.scan("", [this, resultHandler, errorHandler, &readValue](void *keyPtr, int keySize, void *valuePtr, int valueSize) -> bool {
27 const auto key = QByteArray::fromRawData(static_cast<char*>(keyPtr), keySize); 27 const auto key = QByteArray::fromRawData(static_cast<char*>(keyPtr), keySize);
28 if (Akonadi2::Storage::isInternalKey(key)) { 28 if (Akonadi2::Storage::isInternalKey(key)) {
29 return true; 29 return true;
30 } 30 }
31 readValue = true; 31 readValue = true;
32 resultHandler(valuePtr, valueSize, [this, key](bool success) { 32 resultHandler(valuePtr, valueSize, [this, key, errorHandler](bool success) {
33 if (success) { 33 if (success) {
34 mStorage.remove(key.data(), key.size()); 34 mStorage.remove(key.data(), key.size(), [errorHandler](const Akonadi2::Storage::Error &error) {
35 qDebug() << "Error while removing value" << error.message;
36 errorHandler(Error(error.store, error.code, "Error while removing value: " + error.message));
37 });
35 if (isEmpty()) { 38 if (isEmpty()) {
36 emit this->drained(); 39 emit this->drained();
37 } 40 }
@@ -61,6 +64,9 @@ bool MessageQueue::isEmpty()
61 return false; 64 return false;
62 } 65 }
63 return true; 66 return true;
67 },
68 [](const Akonadi2::Storage::Error &error) {
69 qDebug() << "Error while checking if empty" << error.message;
64 }); 70 });
65 return count == 0; 71 return count == 0;
66} 72}
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index ed40699..e2f23ed 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -293,6 +293,9 @@ void PipelineState::step()
293 auto entity = Akonadi2::GetEntity(dataValue); 293 auto entity = Akonadi2::GetEntity(dataValue);
294 preprocessor->process(*this, *entity); 294 preprocessor->process(*this, *entity);
295 return false; 295 return false;
296 }, [this](const Akonadi2::Storage::Error &error) {
297 ErrorMsg() << "Failed to find value in pipeline: " << error.message;
298 d->pipeline->pipelineCompleted(*this);
296 }); 299 });
297 } else { 300 } else {
298 //This object becomes invalid after this call 301 //This object becomes invalid after this call