summaryrefslogtreecommitdiffstats
path: root/common/queryrunner.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-06-25 10:57:46 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-06-25 11:08:29 +0200
commit121c3bc96a273790414ae114082053cb649fc49a (patch)
tree262f994aaa0f7008aa9acf7589fc99a4447740f7 /common/queryrunner.h
parented17c92c9f3be95e9b280f2abc67f1c0ba48e8c4 (diff)
downloadsink-121c3bc96a273790414ae114082053cb649fc49a.tar.gz
sink-121c3bc96a273790414ae114082053cb649fc49a.zip
Fixed the lost update scenario
If we get a fetchMore right between when the revision was updated and the incrementalQuery actually running, we ended up loosing the update because the result provider ended up with a too recent revision after the additional initial query.
Diffstat (limited to 'common/queryrunner.h')
-rw-r--r--common/queryrunner.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/common/queryrunner.h b/common/queryrunner.h
index e449570..52b5e2d 100644
--- a/common/queryrunner.h
+++ b/common/queryrunner.h
@@ -35,6 +35,16 @@ class QueryRunnerBase : public QObject
35public: 35public:
36 typedef std::function<void(Sink::ApplicationDomain::ApplicationDomainType &domainObject)> ResultTransformation; 36 typedef std::function<void(Sink::ApplicationDomain::ApplicationDomainType &domainObject)> ResultTransformation;
37 37
38 /// Disable query updates on revision change. Used for testing only.
39 void ignoreRevisionChanges(bool ignore) {
40 mIgnoreRevisionChanges = ignore;
41 }
42
43 /// Manually triger a revision change. Used for testing only.
44 void triggerRevisionChange() {
45 revisionChanged();
46 }
47
38protected: 48protected:
39 typedef std::function<KAsync::Job<void>()> QueryFunction; 49 typedef std::function<KAsync::Job<void>()> QueryFunction;
40 50
@@ -52,7 +62,9 @@ protected slots:
52 */ 62 */
53 void revisionChanged() 63 void revisionChanged()
54 { 64 {
55 run().exec(); 65 if (!mIgnoreRevisionChanges) {
66 run().exec();
67 }
56 } 68 }
57 69
58private: 70private:
@@ -65,6 +77,7 @@ private:
65 } 77 }
66 78
67 QueryFunction queryFunction; 79 QueryFunction queryFunction;
80 bool mIgnoreRevisionChanges{false};
68}; 81};
69 82
70/** 83/**