diff --git a/src/colnod/syncmanager.cpp b/src/colnod/syncmanager.cpp index 442a23b..342d1ab 100644 --- a/src/colnod/syncmanager.cpp +++ b/src/colnod/syncmanager.cpp @@ -45,7 +45,6 @@ bool SyncManager::startSynchronization() qInfo(syncmanager) << equals; qInfo(syncmanager) << "SYNCHRONIZATION BEGIN"; - qInfo(syncmanager) << equals; qInfo(syncmanager) << "DOWNLOADING DATA -> BEGIN"; qInfo(syncmanager) << dash; @@ -62,15 +61,14 @@ bool SyncManager::startSynchronization() colnod->downloadData(mlastSync.timestamp()); connect(colnod.get(), &ColnodAPI::downloadDataFinished, [=](std::shared_ptr colnodData) { - qInfo(syncmanager) << "DOWNLOADING DATA -> FINISHED"; - qInfo(syncmanager) << equals; - if (!colnodData) { qCritical(syncmanager) << "Not possible to get correct data from colnod"; QCoreApplication::exit(-1); return; } + qInfo(syncmanager) << "DOWNLOADING DATA -> FINISHED"; + qInfo(syncmanager) << equals; // NOW I SHOULD HAVE VALID DATA FROM COLNOD @@ -92,7 +90,11 @@ bool SyncManager::startSynchronization() } // data is processed to other sides - connect(colnod.get(), &ColnodAPI::dataProcessFinished, [&](){ + connect(colnod.get(), &ColnodAPI::dataProcessFinished, [&](bool success){ + if (!success) { + qCritical(syncmanager) << "Not possible to upload data to colnod"; + } + qInfo(syncmanager) << "PROCESSING DATA -> FINISHED"; qInfo(syncmanager) << equals; @@ -105,6 +107,7 @@ bool SyncManager::startSynchronization() // updated data are ready connect(tokensRequest.get(), &serversdk::Request::finished, [=](){ + auto uploadedData = std::make_shared(); uploadedData->loadTokensFromJson(tokensRequest->responseData()); @@ -139,9 +142,7 @@ bool SyncManager::startSynchronization() }); - colnod->processData(preparedData->databaseData); // TODO: errors??? - - //qCritical(syncmanager) << "Not possible to upload data to colnod"; + colnod->processData(preparedData->databaseData); }); return true; @@ -162,7 +163,7 @@ std::unique_ptr SyncManager::prepareDataNew(const std::shared_ptr< qInfo(syncmanager) << "Resolve conflicts ( changes on same item on both Colnod and DB ):"; qInfo(syncmanager) << dash; - + // add all data which should be pushed to database for (const auto &colnodToken : colnodData->updatedTokens) { // not conflict so add to prepered tokens