##// END OF EJS Templates
Remove regression for aborting request during processRequest method
perrinel -
r823:83da67fa98c8
parent child
Show More
@@ -102,6 +102,7 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid v
102
102
103 // remove old acqIdentifier from the worker
103 // remove old acqIdentifier from the worker
104 impl->cancelVarRequest(varRequestIdCanceled);
104 impl->cancelVarRequest(varRequestIdCanceled);
105 // impl->m_AcqIdentifierToAcqRequestMap.erase(oldAcqId);
105 }
106 }
106 else {
107 else {
107 // First request for the variable, it must be stored and executed
108 // First request for the variable, it must be stored and executed
@@ -141,7 +141,6 struct VariableController::VariableControllerPrivate {
141
141
142 std::map<QUuid, std::deque<QUuid> > m_VarIdToVarRequestIdQueueMap;
142 std::map<QUuid, std::deque<QUuid> > m_VarIdToVarRequestIdQueueMap;
143
143
144
145 VariableController *q;
144 VariableController *q;
146 };
145 };
147
146
@@ -282,11 +281,11 VariableController::createVariable(const QString &name, const QVariantHash &meta
282
281
283 // Associate the provider
282 // Associate the provider
284 impl->m_VariableToProviderMap[newVariable] = provider;
283 impl->m_VariableToProviderMap[newVariable] = provider;
285 qCInfo(LOG_VariableController()) << "createVariable: " << identifier;
286 impl->m_VariableToIdentifierMap[newVariable] = identifier;
284 impl->m_VariableToIdentifierMap[newVariable] = identifier;
287
285
288
286
289 auto varRequestId = QUuid::createUuid();
287 auto varRequestId = QUuid::createUuid();
288 qCInfo(LOG_VariableController()) << "createVariable: " << identifier << varRequestId;
290 impl->processRequest(newVariable, range, varRequestId);
289 impl->processRequest(newVariable, range, varRequestId);
291 impl->updateVariableRequest(varRequestId);
290 impl->updateVariableRequest(varRequestId);
292
291
@@ -471,7 +470,7 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable>
471 << QThread::currentThread()->objectName() << varRequestId;
470 << QThread::currentThread()->objectName() << varRequestId;
472
471
473 for (const auto &var : variables) {
472 for (const auto &var : variables) {
474 qCDebug(LOG_VariableController()) << "processRequest for" << var->name() << varRequestId;
473 qCInfo(LOG_VariableController()) << "processRequest for" << var->name() << varRequestId;
475 impl->processRequest(var, range, varRequestId);
474 impl->processRequest(var, range, varRequestId);
476 }
475 }
477
476
@@ -508,8 +507,8 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable>
508 // Don't process already processed var
507 // Don't process already processed var
509 if (!variables.contains(var)) {
508 if (!variables.contains(var)) {
510 if (var != nullptr) {
509 if (var != nullptr) {
511 qCDebug(LOG_VariableController()) << "processRequest synchro for"
510 qCInfo(LOG_VariableController()) << "processRequest synchro for"
512 << var->name();
511 << var->name() << varRequestId;
513 auto vSyncRangeRequested = computeSynchroRangeRequested(
512 auto vSyncRangeRequested = computeSynchroRangeRequested(
514 var->range(), range, groupIdToOldRangeMap.at(gId));
513 var->range(), range, groupIdToOldRangeMap.at(gId));
515 qCDebug(LOG_VariableController()) << "synchro RR" << vSyncRangeRequested;
514 qCDebug(LOG_VariableController()) << "synchro RR" << vSyncRangeRequested;
@@ -616,12 +615,6 void VariableController::VariableControllerPrivate::processRequest(std::shared_p
616 DataProviderParameters{std::move(notInCacheRangeList), var->metadata()},
615 DataProviderParameters{std::move(notInCacheRangeList), var->metadata()},
617 varProvider);
616 varProvider);
618
617
619 if (!varRequestIdCanceled.isNull()) {
620 qCInfo(LOG_VariableAcquisitionWorker()) << tr("varRequestIdCanceled: ")
621 << varRequestIdCanceled;
622 // cancelVariableRequest(varRequestIdCanceled);
623 abortVariableRequest(varRequestIdCanceled);
624 }
625 }
618 }
626 else {
619 else {
627 qCCritical(LOG_VariableController())
620 qCCritical(LOG_VariableController())
@@ -862,6 +855,9 void VariableController::VariableControllerPrivate::abortVariableRequest(QUuid v
862 if (varRequestIdToVarIdVarRequestMapIt != m_VarRequestIdToVarIdVarRequestMap.cend()) {
855 if (varRequestIdToVarIdVarRequestMapIt != m_VarRequestIdToVarIdVarRequestMap.cend()) {
863 varRequestIdsMap = varRequestIdToVarIdVarRequestMapIt->second;
856 varRequestIdsMap = varRequestIdToVarIdVarRequestMapIt->second;
864 }
857 }
858 qCCritical(LOG_VariableController())
859 << tr("abortVariableRequest : varRequestId and count of aborting") << varRequestId
860 << varRequestIdsMap.size();
865
861
866 auto nextUuidToRemove = QSet<QUuid>{};
862 auto nextUuidToRemove = QSet<QUuid>{};
867 auto varIdEnd = varRequestIdsMap.end();
863 auto varIdEnd = varRequestIdsMap.end();
@@ -891,6 +887,9 void VariableController::VariableControllerPrivate::abortVariableRequest(QUuid v
891 }
887 }
892 }
888 }
893
889
890 qCCritical(LOG_VariableController()) << tr("remove the request : aborting")
891 << currentVarId;
892
894 varReqIdQueueIt = varRequestIdQueue.erase(varReqIdQueueIt);
893 varReqIdQueueIt = varRequestIdQueue.erase(varReqIdQueueIt);
895 // break is necessary here, we don"t need to iterate on the dequeue anymore and
894 // break is necessary here, we don"t need to iterate on the dequeue anymore and
896 // the iteration is broken because of the erase
895 // the iteration is broken because of the erase
@@ -910,10 +909,13 void VariableController::VariableControllerPrivate::abortVariableRequest(QUuid v
910 }
909 }
911
910
912 if (varRequestIdToVarIdVarRequestMapIt != m_VarRequestIdToVarIdVarRequestMap.cend()) {
911 if (varRequestIdToVarIdVarRequestMapIt != m_VarRequestIdToVarIdVarRequestMap.cend()) {
912 qCCritical(LOG_VariableController()) << tr("remove the varRequestId");
913 m_VarRequestIdToVarIdVarRequestMap.erase(varRequestIdToVarIdVarRequestMapIt);
913 m_VarRequestIdToVarIdVarRequestMap.erase(varRequestIdToVarIdVarRequestMapIt);
914 }
914 }
915
915
916 for (auto nextVarRequestIdToRm : nextUuidToRemove) {
916 for (auto nextVarRequestIdToRm : nextUuidToRemove) {
917 qCCritical(LOG_VariableController()) << tr("Cancel automaticaly the next request:")
918 << nextVarRequestIdToRm;
917 abortVariableRequest(nextVarRequestIdToRm);
919 abortVariableRequest(nextVarRequestIdToRm);
918 }
920 }
919 }
921 }
General Comments 0
You need to be logged in to leave comments. Login now