From 83da67fa98c8a9f52ed6d63ab8f3317897545ede 2017-10-05 14:10:15 From: mperrinel Date: 2017-10-05 14:10:15 Subject: [PATCH] Remove regression for aborting request during processRequest method --- diff --git a/core/src/Variable/VariableAcquisitionWorker.cpp b/core/src/Variable/VariableAcquisitionWorker.cpp index 62c94f9..8487848 100644 --- a/core/src/Variable/VariableAcquisitionWorker.cpp +++ b/core/src/Variable/VariableAcquisitionWorker.cpp @@ -102,6 +102,7 @@ QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid v // remove old acqIdentifier from the worker impl->cancelVarRequest(varRequestIdCanceled); + // impl->m_AcqIdentifierToAcqRequestMap.erase(oldAcqId); } else { // First request for the variable, it must be stored and executed diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index 419a4e0..0ab41b0 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -141,7 +141,6 @@ struct VariableController::VariableControllerPrivate { std::map > m_VarIdToVarRequestIdQueueMap; - VariableController *q; }; @@ -282,11 +281,11 @@ VariableController::createVariable(const QString &name, const QVariantHash &meta // Associate the provider impl->m_VariableToProviderMap[newVariable] = provider; - qCInfo(LOG_VariableController()) << "createVariable: " << identifier; impl->m_VariableToIdentifierMap[newVariable] = identifier; auto varRequestId = QUuid::createUuid(); + qCInfo(LOG_VariableController()) << "createVariable: " << identifier << varRequestId; impl->processRequest(newVariable, range, varRequestId); impl->updateVariableRequest(varRequestId); @@ -471,7 +470,7 @@ void VariableController::onRequestDataLoading(QVector << QThread::currentThread()->objectName() << varRequestId; for (const auto &var : variables) { - qCDebug(LOG_VariableController()) << "processRequest for" << var->name() << varRequestId; + qCInfo(LOG_VariableController()) << "processRequest for" << var->name() << varRequestId; impl->processRequest(var, range, varRequestId); } @@ -508,8 +507,8 @@ void VariableController::onRequestDataLoading(QVector // Don't process already processed var if (!variables.contains(var)) { if (var != nullptr) { - qCDebug(LOG_VariableController()) << "processRequest synchro for" - << var->name(); + qCInfo(LOG_VariableController()) << "processRequest synchro for" + << var->name() << varRequestId; auto vSyncRangeRequested = computeSynchroRangeRequested( var->range(), range, groupIdToOldRangeMap.at(gId)); qCDebug(LOG_VariableController()) << "synchro RR" << vSyncRangeRequested; @@ -616,12 +615,6 @@ void VariableController::VariableControllerPrivate::processRequest(std::shared_p DataProviderParameters{std::move(notInCacheRangeList), var->metadata()}, varProvider); - if (!varRequestIdCanceled.isNull()) { - qCInfo(LOG_VariableAcquisitionWorker()) << tr("varRequestIdCanceled: ") - << varRequestIdCanceled; - // cancelVariableRequest(varRequestIdCanceled); - abortVariableRequest(varRequestIdCanceled); - } } else { qCCritical(LOG_VariableController()) @@ -862,6 +855,9 @@ void VariableController::VariableControllerPrivate::abortVariableRequest(QUuid v if (varRequestIdToVarIdVarRequestMapIt != m_VarRequestIdToVarIdVarRequestMap.cend()) { varRequestIdsMap = varRequestIdToVarIdVarRequestMapIt->second; } + qCCritical(LOG_VariableController()) + << tr("abortVariableRequest : varRequestId and count of aborting") << varRequestId + << varRequestIdsMap.size(); auto nextUuidToRemove = QSet{}; auto varIdEnd = varRequestIdsMap.end(); @@ -891,6 +887,9 @@ void VariableController::VariableControllerPrivate::abortVariableRequest(QUuid v } } + qCCritical(LOG_VariableController()) << tr("remove the request : aborting") + << currentVarId; + varReqIdQueueIt = varRequestIdQueue.erase(varReqIdQueueIt); // break is necessary here, we don"t need to iterate on the dequeue anymore and // the iteration is broken because of the erase @@ -910,10 +909,13 @@ void VariableController::VariableControllerPrivate::abortVariableRequest(QUuid v } if (varRequestIdToVarIdVarRequestMapIt != m_VarRequestIdToVarIdVarRequestMap.cend()) { + qCCritical(LOG_VariableController()) << tr("remove the varRequestId"); m_VarRequestIdToVarIdVarRequestMap.erase(varRequestIdToVarIdVarRequestMapIt); } for (auto nextVarRequestIdToRm : nextUuidToRemove) { + qCCritical(LOG_VariableController()) << tr("Cancel automaticaly the next request:") + << nextVarRequestIdToRm; abortVariableRequest(nextVarRequestIdToRm); } }