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