From 35ae961b37dfc860ab52edd69093d71c5b2a732f Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 25 Jan 2015 19:06:55 +0100 Subject: debug output --- common/pipeline.cpp | 3 ++- dummyresource/facade.cpp | 2 +- dummyresource/resourcefactory.cpp | 22 ++++++---------------- synchronizer/listener.cpp | 1 + 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/common/pipeline.cpp b/common/pipeline.cpp index 13a3344..f440c6d 100644 --- a/common/pipeline.cpp +++ b/common/pipeline.cpp @@ -95,7 +95,7 @@ void Pipeline::null() Async::Job Pipeline::newEntity(void const *command, size_t size) { - qDebug() << "new entity" << size; + qDebug() << "Pipeline: New Entity"; //TODO toRFC4122 would probably be more efficient, but results in non-printable keys. const auto key = QUuid::createUuid().toString().toUtf8(); @@ -137,6 +137,7 @@ Async::Job Pipeline::newEntity(void const *command, size_t size) storage().write(key.data(), key.size(), fbb.GetBufferPointer(), fbb.GetSize()); storage().setMaxRevision(newRevision); + qDebug() << "Pipeline: wrote entity: "<< newRevision; return Async::start([this, key, entityType](Async::Future &future) { PipelineState state(this, NewPipeline, key, d->newPipeline[entityType], [&future]() { diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index fcce871..79763ef 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp @@ -189,7 +189,7 @@ void DummyResourceFacade::readValue(QSharedPointer storage, c return true; }, [](const Akonadi2::Storage::Error &error) { - qDebug() << QString::fromStdString(error.message); + qWarning() << "Error during query: " << QString::fromStdString(error.message); }); } diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp index 3180b9a..aefd66f 100644 --- a/dummyresource/resourcefactory.cpp +++ b/dummyresource/resourcefactory.cpp @@ -67,15 +67,6 @@ protected: QString mId; }; -// template -// class SimpleReadOnlyProcessor : public SimpleProcessor -// { -// public: -// using SimpleProcessor::SimpleProcessor; -// void process(Akonadi2::PipelineState state) { -// mFunction(); -// } -// }; static std::string createEvent() @@ -123,6 +114,7 @@ public: { for (auto queue : mCommandQueues) { bool ret = connect(queue, &MessageQueue::messageReady, this, &Processor::process); + Q_UNUSED(ret); Q_ASSERT(ret); } } @@ -184,7 +176,7 @@ private slots: future.setFinished(); }, [this, messageQueueCallback, whileCallback](int errorCode, const QString &errorMessage) { - qDebug() << "Error while creating entity: " << errorCode << errorMessage; + qWarning() << "Error while creating entity: " << errorCode << errorMessage; emit error(errorCode, errorMessage); messageQueueCallback(true); whileCallback(false); @@ -200,7 +192,6 @@ private slots: } }, [whileCallback](const MessageQueue::Error &error) { - qDebug() << "no more messages in queue"; whileCallback(true); }); }, @@ -260,7 +251,7 @@ void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline) //Eventually the order should be self configuring, for now it's hardcoded. auto eventIndexer = new SimpleProcessor("summaryprocessor", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { auto adaptor = eventFactory->createAdaptor(entity); - qDebug() << "Summary preprocessor: " << adaptor->getProperty("summary").toString(); + // qDebug() << "Summary preprocessor: " << adaptor->getProperty("summary").toString(); }); auto uidIndexer = new SimpleProcessor("uidIndexer", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { @@ -293,7 +284,7 @@ void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline) void DummyResource::onProcessorError(int errorCode, const QString &errorMessage) { - qDebug() << "Received error from Processor: " << errorCode << errorMessage; + qWarning() << "Received error from Processor: " << errorCode << errorMessage; mError = errorCode; } @@ -340,7 +331,6 @@ void DummyResource::enqueueCommand(MessageQueue &mq, int commandId, const QByteA Async::Job DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeline) { - qDebug() << "synchronizeWithSource"; return Async::start([this, pipeline](Async::Future &f) { //TODO use a read-only transaction during the complete sync to sync against a defined revision auto storage = QSharedPointer::create(Akonadi2::Store::storageLocation(), "org.kde.dummy"); @@ -387,7 +377,6 @@ Async::Job DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeli } } //TODO find items to remove - qDebug() << "sync complete"; f.setFinished(); }); } @@ -399,9 +388,11 @@ Async::Job DummyResource::processAllMessages() //TODO: report errors while processing sync? //TODO: also check user-queue? if (mSynchronizerQueue.isEmpty()) { + qDebug() << "synchronizer queue is empty"; f.setFinished(); } else { QObject::connect(&mSynchronizerQueue, &MessageQueue::drained, [&f]() { + qDebug() << "synchronizer queue drained"; f.setFinished(); }); } @@ -410,7 +401,6 @@ Async::Job DummyResource::processAllMessages() void DummyResource::processCommand(int commandId, const QByteArray &data, uint size, Akonadi2::Pipeline *pipeline) { - qDebug() << "processCommand"; //TODO instead of copying the command including the full entity first into the command queue, we could directly //create a new revision, only pushing a handle into the commandqueue with the relevant changeset (for changereplay). //The problem is that we then require write access from multiple threads (or even processes to avoid sending the full entity over the wire). diff --git a/synchronizer/listener.cpp b/synchronizer/listener.cpp index 147ed9f..1294c76 100644 --- a/synchronizer/listener.cpp +++ b/synchronizer/listener.cpp @@ -129,6 +129,7 @@ void Listener::clientDropped() void Listener::checkConnections() { if (m_connections.isEmpty()) { + log(QString("No connections, shutting down.")); m_server->close(); emit noClients(); } -- cgit v1.2.3