made concurent task fail

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-07-14 21:07:53 +03:00
parent 7f4665e3cc
commit d3dc00dcab
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 10 additions and 11 deletions

View File

@ -112,7 +112,6 @@ void Flame::FileResolvingTask::netJobFinished()
connect(m_checkJob.get(), &NetJob::failed, this, [this, step_progress](QString reason) { connect(m_checkJob.get(), &NetJob::failed, this, [this, step_progress](QString reason) {
step_progress->state = TaskStepState::Failed; step_progress->state = TaskStepState::Failed;
stepProgress(*step_progress); stepProgress(*step_progress);
emitFailed(reason);
}); });
connect(m_checkJob.get(), &NetJob::stepProgress, this, &FileResolvingTask::propogateStepProgress); connect(m_checkJob.get(), &NetJob::stepProgress, this, &FileResolvingTask::propogateStepProgress);
connect(m_checkJob.get(), &NetJob::progress, this, [this, step_progress](qint64 current, qint64 total) { connect(m_checkJob.get(), &NetJob::progress, this, [this, step_progress](qint64 current, qint64 total) {

View File

@ -118,8 +118,11 @@ void ConcurrentTask::startNext()
if (m_aborted || m_doing.count() > m_total_max_size) if (m_aborted || m_doing.count() > m_total_max_size)
return; return;
if (m_queue.isEmpty() && m_doing.isEmpty() && !wasSuccessful()) { if (m_queue.isEmpty() && m_doing.isEmpty() && isRunning()) {
if (m_failed.isEmpty())
emitSucceeded(); emitSucceeded();
else
emitFailed(tr("One or more subtasks failed"));
return; return;
} }
@ -254,12 +257,10 @@ void ConcurrentTask::subTaskStepProgress(Task::Ptr task, TaskStepProgress const&
emit stepProgress(*tp.get()); emit stepProgress(*tp.get());
updateStepProgress(*tp.get(), op); updateStepProgress(*tp.get(), op);
} }
} }
void ConcurrentTask::updateStepProgress(TaskStepProgress const& changed_progress, Operation op) void ConcurrentTask::updateStepProgress(TaskStepProgress const& changed_progress, Operation op)
{ {
switch (op) { switch (op) {
case Operation::ADDED: case Operation::ADDED:
m_stepProgress += changed_progress.current; m_stepProgress += changed_progress.current;
@ -276,7 +277,6 @@ void ConcurrentTask::updateStepProgress(TaskStepProgress const& changed_progress
m_stepTotalProgress += changed_progress.total; m_stepTotalProgress += changed_progress.total;
break; break;
} }
} }
void ConcurrentTask::updateState() void ConcurrentTask::updateState()