summaryrefslogtreecommitdiffstats
path: root/common/synchronizer.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-28 09:26:50 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-28 09:26:50 +0200
commit547e5e29cbfc12474ab45768ff0d9342882b2633 (patch)
tree6728cb767b5c3a2ce450a6621815cc7fd8c0bd96 /common/synchronizer.cpp
parent8b69affc452cd828824ee77653f40d4c4f8d0658 (diff)
downloadsink-547e5e29cbfc12474ab45768ff0d9342882b2633.tar.gz
sink-547e5e29cbfc12474ab45768ff0d9342882b2633.zip
Track the entities that this request applies to directly in the
syncrequest That way we can do the notification emitting in the synchronizer and it keeps working even if the login already fails (so the synchronizing code would never be executed).
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r--common/synchronizer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp
index ec896ed..329841b 100644
--- a/common/synchronizer.cpp
+++ b/common/synchronizer.cpp
@@ -329,7 +329,7 @@ KAsync::Job<void> Synchronizer::processRequest(const SyncRequest &request)
329 return KAsync::start([this, request] { 329 return KAsync::start([this, request] {
330 SinkLogCtx(mLogCtx) << "Synchronizing: " << request.query; 330 SinkLogCtx(mLogCtx) << "Synchronizing: " << request.query;
331 emitNotification(Notification::Status, ApplicationDomain::BusyStatus, "Synchronization has started.", request.requestId); 331 emitNotification(Notification::Status, ApplicationDomain::BusyStatus, "Synchronization has started.", request.requestId);
332 emitNotification(Notification::Info, ApplicationDomain::SyncInProgress, {}, {}, request.query.ids()); 332 emitNotification(Notification::Info, ApplicationDomain::SyncInProgress, {}, {}, request.applicableEntities);
333 }).then(synchronizeWithSource(request.query)).then([this] { 333 }).then(synchronizeWithSource(request.query)).then([this] {
334 //Commit after every request, so implementations only have to commit more if they add a lot of data. 334 //Commit after every request, so implementations only have to commit more if they add a lot of data.
335 commit(); 335 commit();
@@ -337,12 +337,12 @@ KAsync::Job<void> Synchronizer::processRequest(const SyncRequest &request)
337 if (error) { 337 if (error) {
338 //Emit notification with error 338 //Emit notification with error
339 SinkWarningCtx(mLogCtx) << "Synchronization failed: " << error.errorMessage; 339 SinkWarningCtx(mLogCtx) << "Synchronization failed: " << error.errorMessage;
340 emitNotification(Notification::Warning, ApplicationDomain::SyncError, {}, {}, request.query.ids()); 340 emitNotification(Notification::Warning, ApplicationDomain::SyncError, {}, {}, request.applicableEntities);
341 emitNotification(Notification::Status, ApplicationDomain::ErrorStatus, "Synchronization has ended.", request.requestId); 341 emitNotification(Notification::Status, ApplicationDomain::ErrorStatus, "Synchronization has ended.", request.requestId);
342 return KAsync::error(error); 342 return KAsync::error(error);
343 } else { 343 } else {
344 SinkLogCtx(mLogCtx) << "Done Synchronizing"; 344 SinkLogCtx(mLogCtx) << "Done Synchronizing";
345 emitNotification(Notification::Info, ApplicationDomain::SyncSuccess, {}, {}, request.query.ids()); 345 emitNotification(Notification::Info, ApplicationDomain::SyncSuccess, {}, {}, request.applicableEntities);
346 emitNotification(Notification::Status, ApplicationDomain::ConnectedStatus, "Synchronization has ended.", request.requestId); 346 emitNotification(Notification::Status, ApplicationDomain::ConnectedStatus, "Synchronization has ended.", request.requestId);
347 return KAsync::null(); 347 return KAsync::null();
348 } 348 }