summaryrefslogtreecommitdiffstats
path: root/common/changereplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/changereplay.cpp')
-rw-r--r--common/changereplay.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/changereplay.cpp b/common/changereplay.cpp
index 532cca8..7895b66 100644
--- a/common/changereplay.cpp
+++ b/common/changereplay.cpp
@@ -29,10 +29,10 @@
29using namespace Sink; 29using namespace Sink;
30using namespace Sink::Storage; 30using namespace Sink::Storage;
31 31
32ChangeReplay::ChangeReplay(const ResourceContext &resourceContext) 32ChangeReplay::ChangeReplay(const ResourceContext &resourceContext, const Sink::Log::Context &ctx)
33 : mStorage(storageLocation(), resourceContext.instanceId(), DataStore::ReadOnly), mChangeReplayStore(storageLocation(), resourceContext.instanceId() + ".changereplay", DataStore::ReadWrite), mReplayInProgress(false), mLogCtx{"changereplay"} 33 : mStorage(storageLocation(), resourceContext.instanceId(), DataStore::ReadOnly), mChangeReplayStore(storageLocation(), resourceContext.instanceId() + ".changereplay", DataStore::ReadWrite), mReplayInProgress(false), mLogCtx{ctx.subContext("changereplay")},
34 mGuard{new QObject}
34{ 35{
35 SinkTraceCtx(mLogCtx) << "Created change replay: " << resourceContext.instanceId();
36} 36}
37 37
38qint64 ChangeReplay::getLastReplayedRevision() 38qint64 ChangeReplay::getLastReplayedRevision()
@@ -54,7 +54,6 @@ bool ChangeReplay::allChangesReplayed()
54 SinkWarningCtx(mLogCtx) << error.message; 54 SinkWarningCtx(mLogCtx) << error.message;
55 })); 55 }));
56 const qint64 lastReplayedRevision = getLastReplayedRevision(); 56 const qint64 lastReplayedRevision = getLastReplayedRevision();
57 SinkTraceCtx(mLogCtx) << "Checking if all replayed. Top revision:" << topRevision << "Last replayed:" << lastReplayedRevision;
58 return (lastReplayedRevision >= topRevision); 57 return (lastReplayedRevision >= topRevision);
59} 58}
60 59
@@ -99,8 +98,12 @@ KAsync::Job<void> ChangeReplay::replayNextRevision()
99 SinkTraceCtx(mLogCtx) << "Changereplay from " << *lastReplayedRevision << " to " << *topRevision; 98 SinkTraceCtx(mLogCtx) << "Changereplay from " << *lastReplayedRevision << " to " << *topRevision;
100 return KAsync::doWhile( 99 return KAsync::doWhile(
101 [this, lastReplayedRevision, topRevision]() -> KAsync::Job<KAsync::ControlFlowFlag> { 100 [this, lastReplayedRevision, topRevision]() -> KAsync::Job<KAsync::ControlFlowFlag> {
101 if (!mGuard) {
102 SinkTraceCtx(mLogCtx) << "Exit due to guard";
103 return KAsync::value(KAsync::Break);
104 }
102 if (*lastReplayedRevision >= *topRevision) { 105 if (*lastReplayedRevision >= *topRevision) {
103 SinkTraceCtx(mLogCtx) << "Done replaying"; 106 SinkTraceCtx(mLogCtx) << "Done replaying" << *lastReplayedRevision << *topRevision;
104 return KAsync::value(KAsync::Break); 107 return KAsync::value(KAsync::Break);
105 } 108 }
106 109