##// END OF EJS Templates
Fix asynchrone bug with reset of the download progress state
perrinel -
r1384:cfb5a07b3479
parent child
Show More
@@ -71,8 +71,7 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid v
71 71
72 72 // Request creation
73 73 auto acqRequest = AcquisitionRequest{};
74 qCDebug(LOG_VariableAcquisitionWorker()) << tr("PushVariableRequest ") << vIdentifier
75 << varRequestId;
74 qCDebug(LOG_VariableAcquisitionWorker()) << tr("Add acqRequest ") << acqRequest.m_AcqIdentifier;
76 75 acqRequest.m_VarRequestId = varRequestId;
77 76 acqRequest.m_vIdentifier = vIdentifier;
78 77 acqRequest.m_DataProviderParameters = parameters;
@@ -151,6 +150,7 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdenti
151 150 double progress)
152 151 {
153 152 qCDebug(LOG_VariableAcquisitionWorker()) << tr("TORM: onVariableRetrieveDataInProgress ")
153 << QThread::currentThread()->objectName()
154 154 << acqIdentifier << progress;
155 155 impl->lockRead();
156 156 auto aIdToARit = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier);
@@ -168,6 +168,8 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdenti
168 168 << QThread::currentThread()->objectName() << aIdToARit->second.m_vIdentifier
169 169 << currentPartSize << currentAlreadyProgress << currentPartProgress << finalProgression;
170 170 if (finalProgression == 100.0) {
171 qCDebug(LOG_VariableAcquisitionWorker())
172 << tr("TORM: onVariableRetrieveDataInProgress : finished : 0.0 ");
171 173 emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, 0.0);
172 174 }
173 175 }
@@ -260,6 +262,8 void VariableAcquisitionWorker::onExecuteRequest(QUuid acqIdentifier)
260 262 auto request = it->second;
261 263 impl->unlock();
262 264 emit variableRequestInProgress(request.m_vIdentifier, 0.1);
265 qCDebug(LOG_VariableAcquisitionWorker()) << tr("Start request 10%") << acqIdentifier
266 << QThread::currentThread();
263 267 request.m_Provider->requestDataLoading(acqIdentifier, request.m_DataProviderParameters);
264 268 }
265 269 else {
@@ -295,12 +299,21 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeVariable
295 299 if (it != m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
296 300 // A current request already exists, we can replace the next one
297 301
302 qCDebug(LOG_VariableAcquisitionWorker())
303 << "VariableAcquisitionWorkerPrivate::removeVariableRequest "
304 << QThread::currentThread()->objectName() << it->second.first;
298 305 m_AcqIdentifierToAcqRequestMap.erase(it->second.first);
299 306 m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second.first);
300 307
308 qCDebug(LOG_VariableAcquisitionWorker())
309 << "VariableAcquisitionWorkerPrivate::removeVariableRequest " << it->second.second;
301 310 m_AcqIdentifierToAcqRequestMap.erase(it->second.second);
302 311 m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second.second);
303 312 }
313
314 // stop any progression
315 emit q->variableRequestInProgress(vIdentifier, 0.0);
316
304 317 m_VIdentifierToCurrrentAcqIdNextIdPairMap.erase(vIdentifier);
305 318 unlock();
306 319 }
@@ -325,6 +338,9 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::updateToNextRe
325 338 unlock();
326 339 // Remove AcquisitionRequest and results;
327 340 lockWrite();
341 qCDebug(LOG_VariableAcquisitionWorker())
342 << "VariableAcquisitionWorkerPrivate::updateToNextRequest removed: "
343 << acqIdentifierToRemove;
328 344 m_AcqIdentifierToAcqRequestMap.erase(acqIdentifierToRemove);
329 345 m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqIdentifierToRemove);
330 346 unlock();
@@ -407,6 +423,9 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeAcqReque
407 423
408 424 lockWrite();
409 425
426 qCDebug(LOG_VariableAcquisitionWorker())
427 << "VariableAcquisitionWorkerPrivate::updateToNextRequest removeAcqRequest: "
428 << acqRequestId;
410 429 m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqRequestId);
411 430 m_AcqIdentifierToAcqRequestMap.erase(acqRequestId);
412 431
General Comments 0
You need to be logged in to leave comments. Login now