From 39b3b6c7ff99f18e8719b28d748ec63adf76808d Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 10 Apr 2017 16:11:45 +0200 Subject: Don't continue processing the pipeline until we have appended the message. Otherwise the processor might think its done before it actually is. --- examples/mailtransportresource/mailtransportresource.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'examples/mailtransportresource/mailtransportresource.cpp') diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index f215643..75d9898 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp @@ -54,7 +54,7 @@ public: KAsync::Job send(const ApplicationDomain::Mail &mail, const MailtransportResource::Settings &settings) { - return KAsync::start([=] { + return KAsync::start([=] { if (!syncStore().readValue(mail.identifier()).isEmpty()) { SinkLog() << "Mail is already sent: " << mail.identifier(); return KAsync::null(); @@ -105,9 +105,8 @@ public: query.filter(resource.getAccount()); return Store::fetchOne(query) .then([this, modifiedMail](const ApplicationDomain::SinkResource &resource) { - //First modify the mail to have the sent property set to true + //Modify the mail to have the sent property set to true, and move it to the new resource. modify(modifiedMail, resource.identifier(), true); - return KAsync::null(); }); }); } @@ -117,12 +116,10 @@ public: return KAsync::start([this]() { QList toSend; SinkLog() << "Looking for mails to send."; - store().readAll([&](const ApplicationDomain::Mail &mail) -> bool { - SinkTrace() << "Found mail: " << mail.identifier(); + store().readAll([&](const ApplicationDomain::Mail &mail) { if (!mail.getSent()) { toSend << mail; } - return true; }); SinkLog() << "Found " << toSend.size() << " mails to send"; auto job = KAsync::null(); -- cgit v1.2.3