[libcalamares] Try to avoid progress going backwards

This is more a test-inspired hack than anything else: since signals
are delivered asynchronously, we can end up delivering progress
signals out-of-order, and then the signal spy lists them wrong:
progress goes backwards.

Insert a tiny delay between jobs to allow signals to be delivered
in-order.
This commit is contained in:
Adriaan de Groot 2020-08-19 15:32:19 +02:00
parent 053321d4d2
commit 9d395e82f0

View File

@ -134,6 +134,7 @@ public:
message = result.message();
details = result.details();
}
QThread::msleep( 16 ); // Very brief rest before reporting the job as complete
emitProgress( 1.0 ); // 100% for *this job*
}
m_jobIndex++;
@ -158,7 +159,6 @@ public:
qreal progress = 0.0;
if ( m_jobIndex < m_runningJobs->count() )
{
const auto& jobitem = m_runningJobs->at( m_jobIndex );
progress = ( jobitem.cumulative + jobitem.weight * percentage ) / m_overallQueueWeight;
message = jobitem.job->prettyStatusMessage();