From 68b5fdf7489b440b61ca375452b0150bd94675e9 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sat, 15 Jul 2023 00:03:11 +0300 Subject: [PATCH 1/3] Ask user to retry if netjob fails Signed-off-by: Trial97 --- launcher/net/NetJob.cpp | 29 +++++++++++++++++++++++++++-- launcher/net/NetJob.h | 1 + 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/launcher/net/NetJob.cpp b/launcher/net/NetJob.cpp index 3869316e3..7b5a87788 100644 --- a/launcher/net/NetJob.cpp +++ b/launcher/net/NetJob.cpp @@ -36,6 +36,8 @@ */ #include "NetJob.h" +#include "tasks/ConcurrentTask.h" +#include "ui/dialogs/CustomMessageBox.h" auto NetJob::addNetAction(NetAction::Ptr action) -> bool { @@ -52,8 +54,11 @@ void NetJob::startNext() // 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())); + while (!m_failed.isEmpty()) { + auto task = m_failed.take(*m_failed.keyBegin()); + m_done.remove(task.get()); + m_queue.enqueue(task); + } } } @@ -127,3 +132,23 @@ void NetJob::updateState() setStatus(tr("Executing %1 task(s) (%2 out of %3 are done)") .arg(QString::number(m_doing.count()), QString::number(m_done.count()), QString::number(totalSize()))); } + +void NetJob::emitFailed(QString reason) +{ + auto response = CustomMessageBox::selectable(nullptr, "Confirm retry", + "The tasks failed\n" + "Failed urls\n" + + getFailedFiles().join("\n\t") + + "\n" + "If this continues to happen please check the logs of the application" + "Do you want to retry?", + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) + ->exec(); + + if (response == QMessageBox::Yes) { + m_try = 0; + startNext(); + return; + } + ConcurrentTask::emitFailed(reason); +} \ No newline at end of file diff --git a/launcher/net/NetJob.h b/launcher/net/NetJob.h index 764cec18b..406ddda63 100644 --- a/launcher/net/NetJob.h +++ b/launcher/net/NetJob.h @@ -68,6 +68,7 @@ class NetJob : public ConcurrentTask { public slots: // Qt can't handle auto at the start for some reason? bool abort() override; + void emitFailed(QString reason) override; protected: void updateState() override; From f33110ee0cf39596d893aae3b5e40de3f282d44d Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 14 Dec 2023 00:19:22 +0200 Subject: [PATCH 2/3] Renamed function Signed-off-by: Trial97 --- launcher/net/NetJob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/net/NetJob.cpp b/launcher/net/NetJob.cpp index faceba058..6740bb8c5 100644 --- a/launcher/net/NetJob.cpp +++ b/launcher/net/NetJob.cpp @@ -155,7 +155,7 @@ void NetJob::emitFailed(QString reason) if (response == QMessageBox::Yes) { m_try = 0; - startNext(); + executeNextSubTask(); return; } #endif From 1d384544d36fdc31b137827b1fc6e0ca62a350cb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 15 May 2024 19:40:15 +0000 Subject: [PATCH 3/3] chore(deps): update cachix/install-nix-action action to v27 --- .github/workflows/update-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml index 855b105ea..a923edd1d 100644 --- a/.github/workflows/update-flake.yml +++ b/.github/workflows/update-flake.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26 + - uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 - uses: DeterminateSystems/update-flake-lock@v21 with: