##// END OF EJS Templates
Fix progression bug when aborting a request for Amda plugin
perrinel -
r758:87c4dffdd5b8
parent child
Show More
@@ -109,7 +109,6 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid v
109
109
110 void VariableAcquisitionWorker::abortProgressRequested(QUuid vIdentifier)
110 void VariableAcquisitionWorker::abortProgressRequested(QUuid vIdentifier)
111 {
111 {
112 // TODO
113 impl->lockRead();
112 impl->lockRead();
114
113
115 auto it = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
114 auto it = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
@@ -144,6 +143,8 void VariableAcquisitionWorker::abortProgressRequested(QUuid vIdentifier)
144 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdentifier,
143 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdentifier,
145 double progress)
144 double progress)
146 {
145 {
146 qCDebug(LOG_VariableAcquisitionWorker()) << tr("TORM: onVariableRetrieveDataInProgress ")
147 << acqIdentifier << progress;
147 impl->lockRead();
148 impl->lockRead();
148 auto aIdToARit = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier);
149 auto aIdToARit = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier);
149 if (aIdToARit != impl->m_AcqIdentifierToAcqRequestMap.cend()) {
150 if (aIdToARit != impl->m_AcqIdentifierToAcqRequestMap.cend()) {
@@ -155,7 +156,9 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdenti
155
156
156 auto finalProgression = currentAlreadyProgress + currentPartProgress;
157 auto finalProgression = currentAlreadyProgress + currentPartProgress;
157 emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, finalProgression);
158 emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, finalProgression);
158
159 qCDebug(LOG_VariableAcquisitionWorker())
160 << tr("TORM: onVariableRetrieveDataInProgress ") << aIdToARit->second.m_vIdentifier
161 << currentPartSize << currentAlreadyProgress << currentPartProgress << finalProgression;
159 if (finalProgression == 100.0) {
162 if (finalProgression == 100.0) {
160 emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, 0.0);
163 emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, 0.0);
161 }
164 }
@@ -203,32 +206,8 void VariableAcquisitionWorker::onVariableDataAcquired(QUuid acqIdentifier,
203 acqRequest.m_CacheRangeRequested, aIdToADPVit->second);
206 acqRequest.m_CacheRangeRequested, aIdToADPVit->second);
204 }
207 }
205
208
206 // Execute the next one
209 // Update to the next request
207 auto it
210 impl->updateToNextRequest(acqRequest.m_vIdentifier);
208 = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(acqRequest.m_vIdentifier);
209
210 if (it != impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
211 if (it->second.second.isNull()) {
212 // There is no next request, we can remove the variable request
213 impl->removeVariableRequest(acqRequest.m_vIdentifier);
214 }
215 else {
216 auto acqIdentifierToRemove = it->second.first;
217 // Move the next request to the current request
218 it->second.first = it->second.second;
219 it->second.second = QUuid();
220 // Remove AcquisitionRequest and results;
221 impl->m_AcqIdentifierToAcqRequestMap.erase(acqIdentifierToRemove);
222 impl->m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqIdentifierToRemove);
223 // Execute the current request
224 QMetaObject::invokeMethod(this, "onExecuteRequest", Qt::QueuedConnection,
225 Q_ARG(QUuid, it->second.first));
226 }
227 }
228 else {
229 qCCritical(LOG_VariableAcquisitionWorker())
230 << tr("Impossible to execute the acquisition on an unfound variable ");
231 }
232 }
211 }
233 }
212 }
234 else {
213 else {
@@ -102,8 +102,8 void AmdaProvider::onReplyDownloadProgress(QUuid acqIdentifier,
102 std::shared_ptr<QNetworkRequest> networkRequest,
102 std::shared_ptr<QNetworkRequest> networkRequest,
103 double progress)
103 double progress)
104 {
104 {
105 qCDebug(LOG_AmdaProvider()) << tr("onReplyDownloadProgress") << acqIdentifier
105 qCInfo(LOG_AmdaProvider()) << tr("onReplyDownloadProgress") << acqIdentifier
106 << networkRequest.get() << progress;
106 << networkRequest.get() << progress;
107 auto acqIdToRequestProgressMapIt = m_AcqIdToRequestProgressMap.find(acqIdentifier);
107 auto acqIdToRequestProgressMapIt = m_AcqIdToRequestProgressMap.find(acqIdentifier);
108 if (acqIdToRequestProgressMapIt != m_AcqIdToRequestProgressMap.end()) {
108 if (acqIdToRequestProgressMapIt != m_AcqIdToRequestProgressMap.end()) {
109
109
@@ -119,8 +119,11 void AmdaProvider::onReplyDownloadProgress(QUuid acqIdentifier,
119 requestProgressMapIt->second = progress;
119 requestProgressMapIt->second = progress;
120 }
120 }
121 else {
121 else {
122 qCCritical(LOG_AmdaProvider()) << tr("Can't retrieve Request in progress")
122 // This case can happened when a progression is send after the request has been
123 << acqIdentifier << networkRequest.get() << progress;
123 // finished.
124 // Generaly the case when aborting a request
125 qCWarning(LOG_AmdaProvider()) << tr("Can't retrieve Request in progress")
126 << acqIdentifier << networkRequest.get() << progress;
124 }
127 }
125 }
128 }
126
129
@@ -146,7 +149,9 void AmdaProvider::onReplyDownloadProgress(QUuid acqIdentifier,
146 emit dataProvidedProgress(acqIdentifier, finalProgress);
149 emit dataProvidedProgress(acqIdentifier, finalProgress);
147 }
150 }
148 else {
151 else {
149 emit dataProvidedProgress(acqIdentifier, 0.0);
152 // This case can happened when a progression is send after the request has been finished.
153 // Generaly the case when aborting a request
154 emit dataProvidedProgress(acqIdentifier, 100.0);
150 }
155 }
151 }
156 }
152
157
@@ -197,6 +202,8 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa
197 /// @todo ALX : debug
202 /// @todo ALX : debug
198 }
203 }
199 }
204 }
205 qCDebug(LOG_AmdaProvider()) << tr("acquisition requests erase because of finishing")
206 << dataId;
200 m_AcqIdToRequestProgressMap.erase(dataId);
207 m_AcqIdToRequestProgressMap.erase(dataId);
201 }
208 }
202
209
@@ -221,6 +228,8 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa
221 }
228 }
222 }
229 }
223 else {
230 else {
231 qCDebug(LOG_AmdaProvider())
232 << tr("acquisition requests erase because of aborting") << dataId;
224 m_AcqIdToRequestProgressMap.erase(dataId);
233 m_AcqIdToRequestProgressMap.erase(dataId);
225 }
234 }
226 };
235 };
General Comments 0
You need to be logged in to leave comments. Login now