mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 21:27:44 +02:00
Merge pull request #1694 from Trial97/concurrent
This commit is contained in:
@ -36,6 +36,7 @@
|
||||
*/
|
||||
|
||||
#include "NetJob.h"
|
||||
#include "tasks/ConcurrentTask.h"
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
#include "Application.h"
|
||||
#endif
|
||||
@ -56,18 +57,15 @@ auto NetJob::addNetAction(NetAction::Ptr action) -> bool
|
||||
return true;
|
||||
}
|
||||
|
||||
void NetJob::startNext()
|
||||
void NetJob::executeNextSubTask()
|
||||
{
|
||||
if (m_queue.isEmpty() && m_doing.isEmpty()) {
|
||||
// We're finished, check for failures and retry if we can (up to 3 times)
|
||||
if (!m_failed.isEmpty() && m_try < 3) {
|
||||
m_try += 1;
|
||||
while (!m_failed.isEmpty())
|
||||
m_queue.enqueue(m_failed.take(*m_failed.keyBegin()));
|
||||
}
|
||||
// We're finished, check for failures and retry if we can (up to 3 times)
|
||||
if (isRunning() && m_queue.isEmpty() && m_doing.isEmpty() && !m_failed.isEmpty() && m_try < 3) {
|
||||
m_try += 1;
|
||||
while (!m_failed.isEmpty())
|
||||
m_queue.enqueue(m_failed.take(*m_failed.keyBegin()));
|
||||
}
|
||||
|
||||
ConcurrentTask::startNext();
|
||||
ConcurrentTask::executeNextSubTask();
|
||||
}
|
||||
|
||||
auto NetJob::size() const -> int
|
||||
|
@ -55,8 +55,6 @@ class NetJob : public ConcurrentTask {
|
||||
explicit NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> network);
|
||||
~NetJob() override = default;
|
||||
|
||||
void startNext() override;
|
||||
|
||||
auto size() const -> int;
|
||||
|
||||
auto canAbort() const -> bool override;
|
||||
@ -69,6 +67,9 @@ class NetJob : public ConcurrentTask {
|
||||
// Qt can't handle auto at the start for some reason?
|
||||
bool abort() override;
|
||||
|
||||
protected slots:
|
||||
void executeNextSubTask() override;
|
||||
|
||||
protected:
|
||||
void updateState() override;
|
||||
|
||||
|
Reference in New Issue
Block a user