From d70e045f90e8b41b5b9f1fa0777d98eed64afb17 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 20 Jul 2024 21:05:19 +0200 Subject: [PATCH] libstore: remove Goal::ecBusy this should be an optional. "busy" is not an *exit* code! Change-Id: Ic231cb27b022312b1a7a7b9602f32845b7a9c934 --- src/libstore/build/goal.cc | 3 +-- src/libstore/build/goal.hh | 4 ++-- src/libstore/build/worker.cc | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libstore/build/goal.cc b/src/libstore/build/goal.cc index f8db98280..2704fc6ab 100644 --- a/src/libstore/build/goal.cc +++ b/src/libstore/build/goal.cc @@ -79,8 +79,7 @@ void Goal::waiteeDone(GoalPtr waitee, ExitCode result) void Goal::amDone(ExitCode result, std::optional ex) { trace("done"); - assert(exitCode == ecBusy); - assert(result == ecSuccess || result == ecFailed || result == ecNoSubstituters || result == ecIncompleteClosure); + assert(!exitCode.has_value()); exitCode = result; if (ex) { diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh index 5b755c275..058c8add8 100644 --- a/src/libstore/build/goal.hh +++ b/src/libstore/build/goal.hh @@ -53,7 +53,7 @@ enum struct JobCategory { struct Goal : public std::enable_shared_from_this { - typedef enum {ecBusy, ecSuccess, ecFailed, ecNoSubstituters, ecIncompleteClosure} ExitCode; + typedef enum {ecSuccess, ecFailed, ecNoSubstituters, ecIncompleteClosure} ExitCode; /** * Backlink to the worker. @@ -96,7 +96,7 @@ struct Goal : public std::enable_shared_from_this /** * Whether the goal is finished. */ - ExitCode exitCode = ecBusy; + std::optional exitCode; protected: /** diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index ea342da3b..f1f024ff6 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -414,7 +414,7 @@ void Worker::waitForInput() GoalPtr goal = j->goal.lock(); assert(goal); - if (goal->exitCode == Goal::ecBusy && + if (!goal->exitCode.has_value() && 0 != settings.maxSilentTime && j->respectTimeouts && after - j->lastOutput >= std::chrono::seconds(settings.maxSilentTime)) @@ -425,7 +425,7 @@ void Worker::waitForInput() continue; } - else if (goal->exitCode == Goal::ecBusy && + else if (!goal->exitCode.has_value() && 0 != settings.buildTimeout && j->respectTimeouts && after - j->timeStarted >= std::chrono::seconds(settings.buildTimeout))