aboutsummaryrefslogtreecommitdiff
path: root/launcher/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/tasks')
-rw-r--r--launcher/tasks/ConcurrentTask.cpp6
-rw-r--r--launcher/tasks/ConcurrentTask.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/launcher/tasks/ConcurrentTask.cpp b/launcher/tasks/ConcurrentTask.cpp
index a890013e..3cc37b2a 100644
--- a/launcher/tasks/ConcurrentTask.cpp
+++ b/launcher/tasks/ConcurrentTask.cpp
@@ -110,14 +110,14 @@ void ConcurrentTask::startNext()
setStepStatus(next->isMultiStep() ? next->getStepStatus() : next->getStatus());
updateState();
+ QCoreApplication::processEvents();
+
QMetaObject::invokeMethod(next.get(), &Task::start, Qt::QueuedConnection);
// Allow going up the number of concurrent tasks in case of tasks being added in the middle of a running task.
- int num_starts = m_total_max_size - m_doing.size();
+ int num_starts = qMin(m_queue.size(), m_total_max_size - m_doing.size());
for (int i = 0; i < num_starts; i++)
QMetaObject::invokeMethod(this, &ConcurrentTask::startNext, Qt::QueuedConnection);
-
- QCoreApplication::processEvents();
}
void ConcurrentTask::subTaskSucceeded(Task::Ptr task)
diff --git a/launcher/tasks/ConcurrentTask.h b/launcher/tasks/ConcurrentTask.h
index b46919fb..d074d2e2 100644
--- a/launcher/tasks/ConcurrentTask.h
+++ b/launcher/tasks/ConcurrentTask.h
@@ -8,6 +8,8 @@
class ConcurrentTask : public Task {
Q_OBJECT
public:
+ using Ptr = shared_qobject_ptr<ConcurrentTask>;
+
explicit ConcurrentTask(QObject* parent = nullptr, QString task_name = "", int max_concurrent = 6);
~ConcurrentTask() override;