summaryrefslogtreecommitdiffstats
path: root/common/queryrunner.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-03-20 14:22:31 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-03-20 14:22:31 +0100
commit1b4c24e0a82d46aba9fd7a1ed6b142d2cc9b0434 (patch)
tree73556faf1fdc3c29c0cc4d2a85f8f612cd7be206 /common/queryrunner.cpp
parent0d0e3271552dd99f227d64979ec9cf9cfed2e007 (diff)
downloadsink-1b4c24e0a82d46aba9fd7a1ed6b142d2cc9b0434.tar.gz
sink-1b4c24e0a82d46aba9fd7a1ed6b142d2cc9b0434.zip
Try to fix race condition causing us to loose initial updates.
The maillist sometimes misses updates, and this might be the root cause of it. Because it's difficult to test we'll just try this fix for now.
Diffstat (limited to 'common/queryrunner.cpp')
-rw-r--r--common/queryrunner.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp
index 2062828..73ccf6d 100644
--- a/common/queryrunner.cpp
+++ b/common/queryrunner.cpp
@@ -77,9 +77,10 @@ QueryRunner<DomainType>::QueryRunner(const Sink::Query &query, const Sink::Resou
77 // Incremental updates are always loaded directly, leaving it up to the result to discard the changes if they are not interesting 77 // Incremental updates are always loaded directly, leaving it up to the result to discard the changes if they are not interesting
78 setQuery([=]() { return incrementalFetch(query, bufferType); }); 78 setQuery([=]() { return incrementalFetch(query, bufferType); });
79 // Ensure the connection is open, if it wasn't already opened 79 // Ensure the connection is open, if it wasn't already opened
80 // TODO If we are not connected already, we have to check for the latest revision once connected, otherwise we could miss some updates
81 mResourceAccess->open(); 80 mResourceAccess->open();
82 QObject::connect(mResourceAccess.data(), &Sink::ResourceAccess::revisionChanged, this, &QueryRunner::revisionChanged); 81 QObject::connect(mResourceAccess.data(), &Sink::ResourceAccess::revisionChanged, this, &QueryRunner::revisionChanged);
82 // open is not synchronous, so from the time when the initial query is started until we have started and connected to the resource, it's possible to miss updates. We therefore unconditionally try to fetch new entities once we are connected.
83 QObject::connect(mResourceAccess.data(), &Sink::ResourceAccess::ready, this, &QueryRunner::revisionChanged);
83 } 84 }
84 mResultProvider->onDone([this]() { 85 mResultProvider->onDone([this]() {
85 delete this; 86 delete this;