libstore: remove Goal::ecBusy

this should be an optional. "busy" is not an *exit* code!

Change-Id: Ic231cb27b022312b1a7a7b9602f32845b7a9c934
This commit is contained in:
eldritch horrors 2024-07-20 21:05:19 +02:00
parent 20f53346df
commit d70e045f90
3 changed files with 5 additions and 6 deletions

View file

@ -79,8 +79,7 @@ void Goal::waiteeDone(GoalPtr waitee, ExitCode result)
void Goal::amDone(ExitCode result, std::optional<Error> ex) void Goal::amDone(ExitCode result, std::optional<Error> ex)
{ {
trace("done"); trace("done");
assert(exitCode == ecBusy); assert(!exitCode.has_value());
assert(result == ecSuccess || result == ecFailed || result == ecNoSubstituters || result == ecIncompleteClosure);
exitCode = result; exitCode = result;
if (ex) { if (ex) {

View file

@ -53,7 +53,7 @@ enum struct JobCategory {
struct Goal : public std::enable_shared_from_this<Goal> struct Goal : public std::enable_shared_from_this<Goal>
{ {
typedef enum {ecBusy, ecSuccess, ecFailed, ecNoSubstituters, ecIncompleteClosure} ExitCode; typedef enum {ecSuccess, ecFailed, ecNoSubstituters, ecIncompleteClosure} ExitCode;
/** /**
* Backlink to the worker. * Backlink to the worker.
@ -96,7 +96,7 @@ struct Goal : public std::enable_shared_from_this<Goal>
/** /**
* Whether the goal is finished. * Whether the goal is finished.
*/ */
ExitCode exitCode = ecBusy; std::optional<ExitCode> exitCode;
protected: protected:
/** /**

View file

@ -414,7 +414,7 @@ void Worker::waitForInput()
GoalPtr goal = j->goal.lock(); GoalPtr goal = j->goal.lock();
assert(goal); assert(goal);
if (goal->exitCode == Goal::ecBusy && if (!goal->exitCode.has_value() &&
0 != settings.maxSilentTime && 0 != settings.maxSilentTime &&
j->respectTimeouts && j->respectTimeouts &&
after - j->lastOutput >= std::chrono::seconds(settings.maxSilentTime)) after - j->lastOutput >= std::chrono::seconds(settings.maxSilentTime))
@ -425,7 +425,7 @@ void Worker::waitForInput()
continue; continue;
} }
else if (goal->exitCode == Goal::ecBusy && else if (!goal->exitCode.has_value() &&
0 != settings.buildTimeout && 0 != settings.buildTimeout &&
j->respectTimeouts && j->respectTimeouts &&
after - j->timeStarted >= std::chrono::seconds(settings.buildTimeout)) after - j->timeStarted >= std::chrono::seconds(settings.buildTimeout))