From 43e282c172c4b5604a4f0d9b70976fc0df00120f Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 25 Jan 2015 14:37:37 +0100 Subject: debug output, fixed dummyresourcetest --- common/storage_lmdb.cpp | 7 +++++++ dummyresource/resourcefactory.cpp | 1 + synchronizer/listener.cpp | 1 + tests/dummyresourcetest.cpp | 7 +++++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index b7fbfed..98c1032 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp @@ -169,6 +169,13 @@ bool Storage::startTransaction(AccessMode type) rc = mdb_txn_begin(d->env, NULL, requestedRead ? MDB_RDONLY : 0, &d->transaction); if (!rc) { rc = mdb_dbi_open(d->transaction, NULL, d->allowDuplicates ? MDB_DUPSORT : 0, &d->dbi); + if (rc) { + qWarning() << "Error while opening transaction: " << mdb_strerror(rc); + } + } else { + if (rc) { + qWarning() << "Error while beginning transaction: " << mdb_strerror(rc); + } } d->firstOpen = false; diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp index f510cd5..3180b9a 100644 --- a/dummyresource/resourcefactory.cpp +++ b/dummyresource/resourcefactory.cpp @@ -397,6 +397,7 @@ Async::Job DummyResource::processAllMessages() return Async::start([this](Async::Future &f) { //We have to wait for all items to be processed to ensure the synced items are available when a query gets executed. //TODO: report errors while processing sync? + //TODO: also check user-queue? if (mSynchronizerQueue.isEmpty()) { f.setFinished(); } else { diff --git a/synchronizer/listener.cpp b/synchronizer/listener.cpp index 6098856..147ed9f 100644 --- a/synchronizer/listener.cpp +++ b/synchronizer/listener.cpp @@ -309,6 +309,7 @@ void Listener::refreshRevision() void Listener::updateClientsWithRevision() { + //FIXME don't send revision updates for revisions that are still being processed. auto command = Akonadi2::CreateRevisionUpdate(m_fbb, m_pipeline->storage().maxRevision()); Akonadi2::FinishRevisionUpdateBuffer(m_fbb, command); diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 5508452..6548659 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp @@ -34,6 +34,7 @@ private Q_SLOTS: void cleanup() { + //TODO kill the synchronizer first? removeFromDisk("org.kde.dummy"); removeFromDisk("org.kde.dummy.userqueue"); removeFromDisk("org.kde.dummy.synchronizerqueue"); @@ -111,7 +112,7 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.dummy"; query.syncOnDemand = false; - query.processAll = false; + query.processAll = true; query.propertyFilter.insert("uid", "testuid"); async::SyncListResult result(Akonadi2::Store::load(query)); @@ -131,8 +132,10 @@ private Q_SLOTS: auto future = job.exec(); future.waitForFinished(); QVERIFY(!future.errorCode()); - QTRY_VERIFY(future.isFinished()); + QVERIFY(future.isFinished()); QVERIFY(!resource.error()); + auto processAllMessagesFuture = resource.processAllMessages().exec(); + processAllMessagesFuture.waitForFinished(); } void testSyncAndFacade() -- cgit v1.2.3