##// END OF EJS Templates
Fix bug in canceling process: the handler canUpdate was always set to ...
perrinel -
r836:c5d1bb9523be
parent child
Show More
@@ -686,8 +686,10 void VariableController::VariableControllerPrivate::processRequest(std::shared_p
686 << varRequest.m_RangeRequested
686 << varRequest.m_RangeRequested
687 << varRequest.m_CacheRangeRequested;
687 << varRequest.m_CacheRangeRequested;
688 auto variableGroupIdToCancel = varHandler->m_PendingVarRequest.m_VariableGroupId;
688 auto variableGroupIdToCancel = varHandler->m_PendingVarRequest.m_VariableGroupId;
689 varHandler->m_PendingVarRequest = varRequest;
690 cancelVariableRequest(variableGroupIdToCancel);
689 cancelVariableRequest(variableGroupIdToCancel);
690 // Cancel variable can make state downgrade
691 varHandler->m_State = VariableRequestHandlerState::PENDING;
692 varHandler->m_PendingVarRequest = varRequest;
691
693
692 break;
694 break;
693 }
695 }
@@ -764,7 +766,8 QUuid VariableController::VariableControllerPrivate::acceptVariableRequest(
764
766
765 auto varHandler = itVarHandler->second.get();
767 auto varHandler = itVarHandler->second.get();
766 if (varHandler->m_State == VariableRequestHandlerState::OFF) {
768 if (varHandler->m_State == VariableRequestHandlerState::OFF) {
767 // TODO log impossible case !!!
769 qCCritical(LOG_VariableController())
770 << tr("acceptVariableRequest impossible on a variable with OFF state");
768 }
771 }
769
772
770 varHandler->m_RunningVarRequest.m_DataSeries = dataSeries;
773 varHandler->m_RunningVarRequest.m_DataSeries = dataSeries;
@@ -793,6 +796,8 void VariableController::VariableControllerPrivate::updateVariables(QUuid varReq
793 auto &varIds = varGroupIdToVarIdsIt->second;
796 auto &varIds = varGroupIdToVarIdsIt->second;
794 auto varIdsEnd = varIds.end();
797 auto varIdsEnd = varIds.end();
795 bool processVariableUpdate = true;
798 bool processVariableUpdate = true;
799 qCDebug(LOG_VariableController()) << "VariableControllerPrivate::updateVariables"
800 << varRequestId << varIds.size();
796 for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd) && processVariableUpdate;
801 for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd) && processVariableUpdate;
797 ++varIdsIt) {
802 ++varIdsIt) {
798 auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
803 auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
@@ -842,7 +847,9 void VariableController::VariableControllerPrivate::updateVariableRequest(QUuid
842 {
847 {
843 auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
848 auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
844 if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
849 if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
845 // TODO LOG cannot update variable request since varGroupdId isn't here anymore
850 qCCritical(LOG_VariableController()) << QObject::tr(
851 "Impossible to updateVariableRequest since varGroupdId isn't here anymore");
852
846 return;
853 return;
847 }
854 }
848
855
@@ -901,7 +908,6 void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid
901 if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
908 if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
902
909
903 auto varHandler = itVarHandler->second.get();
910 auto varHandler = itVarHandler->second.get();
904 varHandler->m_CanUpdate = false;
905 varHandler->m_VarId = QUuid{};
911 varHandler->m_VarId = QUuid{};
906 switch (varHandler->m_State) {
912 switch (varHandler->m_State) {
907 case VariableRequestHandlerState::OFF: {
913 case VariableRequestHandlerState::OFF: {
@@ -919,6 +925,7 void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid
919 itVarHandler->first);
925 itVarHandler->first);
920 }
926 }
921 m_VariableModel->setDataProgress(var, 0.0);
927 m_VariableModel->setDataProgress(var, 0.0);
928 varHandler->m_CanUpdate = false;
922 varHandler->m_State = VariableRequestHandlerState::OFF;
929 varHandler->m_State = VariableRequestHandlerState::OFF;
923 varHandler->m_RunningVarRequest = VariableRequest{};
930 varHandler->m_RunningVarRequest = VariableRequest{};
924 }
931 }
@@ -937,8 +944,10 void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid
937 itVarHandler->first);
944 itVarHandler->first);
938 }
945 }
939 m_VariableModel->setDataProgress(var, 0.0);
946 m_VariableModel->setDataProgress(var, 0.0);
947 varHandler->m_CanUpdate = false;
940 varHandler->m_State = VariableRequestHandlerState::RUNNING;
948 varHandler->m_State = VariableRequestHandlerState::RUNNING;
941 varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest;
949 varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest;
950 varHandler->m_PendingVarRequest = VariableRequest{};
942 executeVarRequest(var, varHandler->m_RunningVarRequest);
951 executeVarRequest(var, varHandler->m_RunningVarRequest);
943 }
952 }
944 else if (varHandler->m_PendingVarRequest.m_VariableGroupId == varRequestId) {
953 else if (varHandler->m_PendingVarRequest.m_VariableGroupId == varRequestId) {
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

Merge lasted acquisition developpement on main Sciqlop branch

You need to be logged in to leave comments. Login now