diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-01 15:17:19 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-01 15:17:19 +0100 |
commit | 7e97222fc6b4fb546b64767e64637b7cbb7ac959 (patch) | |
tree | ca61e121bb076be12194ec667370c7ec1d52d834 /common/pipeline.cpp | |
parent | bbdd4b86328f03b5a466dcff5c7179775c03ab2f (diff) | |
download | sink-7e97222fc6b4fb546b64767e64637b7cbb7ac959.tar.gz sink-7e97222fc6b4fb546b64767e64637b7cbb7ac959.zip |
Pipeline: only emit a change if the revision actually changed.
We had quite a bunch of superfluous notifications before (i.e. during
cleanup).
Diffstat (limited to 'common/pipeline.cpp')
-rw-r--r-- | common/pipeline.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp index 16d8329..acccd90 100644 --- a/common/pipeline.cpp +++ b/common/pipeline.cpp | |||
@@ -42,7 +42,8 @@ class Pipeline::Private | |||
42 | { | 42 | { |
43 | public: | 43 | public: |
44 | Private(const QString &resourceName) | 44 | Private(const QString &resourceName) |
45 | : storage(Akonadi2::storageLocation(), resourceName, Storage::ReadWrite) | 45 | : storage(Akonadi2::storageLocation(), resourceName, Storage::ReadWrite), |
46 | revisionChanged(false) | ||
46 | { | 47 | { |
47 | } | 48 | } |
48 | 49 | ||
@@ -50,6 +51,7 @@ public: | |||
50 | Storage::Transaction transaction; | 51 | Storage::Transaction transaction; |
51 | QHash<QString, QVector<Preprocessor *> > processors; | 52 | QHash<QString, QVector<Preprocessor *> > processors; |
52 | QHash<QString, DomainTypeAdaptorFactoryInterface::Ptr> adaptorFactory; | 53 | QHash<QString, DomainTypeAdaptorFactoryInterface::Ptr> adaptorFactory; |
54 | bool revisionChanged; | ||
53 | }; | 55 | }; |
54 | 56 | ||
55 | Pipeline::Pipeline(const QString &resourceName, QObject *parent) | 57 | Pipeline::Pipeline(const QString &resourceName, QObject *parent) |
@@ -99,7 +101,10 @@ void Pipeline::commit() | |||
99 | d->transaction.commit(); | 101 | d->transaction.commit(); |
100 | } | 102 | } |
101 | d->transaction = Storage::Transaction(); | 103 | d->transaction = Storage::Transaction(); |
102 | emit revisionUpdated(revision); | 104 | if (d->revisionChanged) { |
105 | d->revisionChanged = false; | ||
106 | emit revisionUpdated(revision); | ||
107 | } | ||
103 | } | 108 | } |
104 | 109 | ||
105 | Storage::Transaction &Pipeline::transaction() | 110 | Storage::Transaction &Pipeline::transaction() |
@@ -119,6 +124,7 @@ void Pipeline::storeNewRevision(qint64 newRevision, const flatbuffers::FlatBuffe | |||
119 | Warning() << "Failed to write entity"; | 124 | Warning() << "Failed to write entity"; |
120 | } | 125 | } |
121 | ); | 126 | ); |
127 | d->revisionChanged = true; | ||
122 | Akonadi2::Storage::setMaxRevision(d->transaction, newRevision); | 128 | Akonadi2::Storage::setMaxRevision(d->transaction, newRevision); |
123 | Akonadi2::Storage::recordRevision(d->transaction, newRevision, uid, bufferType); | 129 | Akonadi2::Storage::recordRevision(d->transaction, newRevision, uid, bufferType); |
124 | } | 130 | } |