##// END OF EJS Templates
Fix progression bug when aborting a request for Amda plugin
perrinel -
r701:87c4dffdd5b8
parent child
Show More
@@ -109,7 +109,6 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid v
109 109
110 110 void VariableAcquisitionWorker::abortProgressRequested(QUuid vIdentifier)
111 111 {
112 // TODO
113 112 impl->lockRead();
114 113
115 114 auto it = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
@@ -144,6 +143,8 void VariableAcquisitionWorker::abortProgressRequested(QUuid vIdentifier)
144 143 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdentifier,
145 144 double progress)
146 145 {
146 qCDebug(LOG_VariableAcquisitionWorker()) << tr("TORM: onVariableRetrieveDataInProgress ")
147 << acqIdentifier << progress;
147 148 impl->lockRead();
148 149 auto aIdToARit = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier);
149 150 if (aIdToARit != impl->m_AcqIdentifierToAcqRequestMap.cend()) {
@@ -155,7 +156,9 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdenti
155 156
156 157 auto finalProgression = currentAlreadyProgress + currentPartProgress;
157 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 162 if (finalProgression == 100.0) {
160 163 emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, 0.0);
161 164 }
@@ -203,32 +206,8 void VariableAcquisitionWorker::onVariableDataAcquired(QUuid acqIdentifier,
203 206 acqRequest.m_CacheRangeRequested, aIdToADPVit->second);
204 207 }
205 208
206 // Execute the next one
207 auto it
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 }
209 // Update to the next request
210 impl->updateToNextRequest(acqRequest.m_vIdentifier);
232 211 }
233 212 }
234 213 else {
@@ -102,8 +102,8 void AmdaProvider::onReplyDownloadProgress(QUuid acqIdentifier,
102 102 std::shared_ptr<QNetworkRequest> networkRequest,
103 103 double progress)
104 104 {
105 qCDebug(LOG_AmdaProvider()) << tr("onReplyDownloadProgress") << acqIdentifier
106 << networkRequest.get() << progress;
105 qCInfo(LOG_AmdaProvider()) << tr("onReplyDownloadProgress") << acqIdentifier
106 << networkRequest.get() << progress;
107 107 auto acqIdToRequestProgressMapIt = m_AcqIdToRequestProgressMap.find(acqIdentifier);
108 108 if (acqIdToRequestProgressMapIt != m_AcqIdToRequestProgressMap.end()) {
109 109
@@ -119,8 +119,11 void AmdaProvider::onReplyDownloadProgress(QUuid acqIdentifier,
119 119 requestProgressMapIt->second = progress;
120 120 }
121 121 else {
122 qCCritical(LOG_AmdaProvider()) << tr("Can't retrieve Request in progress")
123 << acqIdentifier << networkRequest.get() << progress;
122 // This case can happened when a progression is send after the request has been
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 149 emit dataProvidedProgress(acqIdentifier, finalProgress);
147 150 }
148 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 202 /// @todo ALX : debug
198 203 }
199 204 }
205 qCDebug(LOG_AmdaProvider()) << tr("acquisition requests erase because of finishing")
206 << dataId;
200 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 230 else {
231 qCDebug(LOG_AmdaProvider())
232 << tr("acquisition requests erase because of aborting") << dataId;
224 233 m_AcqIdToRequestProgressMap.erase(dataId);
225 234 }
226 235 };
General Comments 2
You need to be logged in to leave comments. Login now