Propagator: Simplify sub job finished counting #3844

This commit is contained in:
Christian Kamm 2015-09-17 10:12:23 +02:00
Родитель 95e370b70c
Коммит ef0ab93e05
2 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -619,17 +619,16 @@ void PropagateDirectory::slotSubJobFinished(SyncFileItem::Status status)
_hasError = status;
}
_runningNow--;
_jobsFinished++;
int total = _subJobs.count();
if (!_firstJob) {
total--;
int totalJobs = _subJobs.count();
if (_firstJob) {
totalJobs++;
}
_current++;
// We finished to processing all the jobs
// check if we finished
if (_current >= total) {
if (_jobsFinished >= totalJobs) {
Q_ASSERT(!_runningNow); // how can we finished if there are still jobs running now
finalize();
} else {

Просмотреть файл

@ -171,13 +171,13 @@ public:
SyncFileItemPtr _item;
int _current; // index of the current running job
int _runningNow; // number of subJob running now
int _jobsFinished; // number of jobs that have completed
int _runningNow; // number of subJobs running right now
SyncFileItem::Status _hasError; // NoStatus, or NormalError / SoftError if there was an error
explicit PropagateDirectory(OwncloudPropagator *propagator, const SyncFileItemPtr &item = SyncFileItemPtr(new SyncFileItem))
: PropagatorJob(propagator)
, _firstJob(0), _item(item), _current(-1), _runningNow(0), _hasError(SyncFileItem::NoStatus)
, _firstJob(0), _item(item), _jobsFinished(0), _runningNow(0), _hasError(SyncFileItem::NoStatus)
{ }
virtual ~PropagateDirectory() {