libstore: merge ContinueImmediately and StillAlive
nothing needs to signal being still active but not actively pollable,
only that immediate polling for the next goal work phase is in order.
Change-Id: Ia43c1015e94ba4f5f6b9cb92943da608c4a01555
This commit is contained in:
parent
ccd2862666
commit
aa33c34c9b
|
@ -1751,7 +1751,7 @@ DerivationGoal::continueOrError(kj::Promise<Outcome<void, Goal::Finished>> p)
|
|||
{
|
||||
return p.then([](auto r) -> Result<WorkResult> {
|
||||
if (r.has_value()) {
|
||||
return ContinueImmediately{};
|
||||
return StillAlive{};
|
||||
} else if (r.has_error()) {
|
||||
return r.assume_error();
|
||||
} else {
|
||||
|
|
|
@ -86,7 +86,7 @@ try {
|
|||
});
|
||||
|
||||
state = &DrvOutputSubstitutionGoal::realisationFetched;
|
||||
return pipe.promise.then([]() -> Result<WorkResult> { return ContinueImmediately{}; });
|
||||
return pipe.promise.then([]() -> Result<WorkResult> { return StillAlive{}; });
|
||||
} catch (...) {
|
||||
return {std::current_exception()};
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ try {
|
|||
/* If we are polling goals that are waiting for a lock, then wake
|
||||
up after a few seconds at most. */
|
||||
co_await worker.aio.provider->getTimer().afterDelay(settings.pollInterval.get() * kj::SECONDS);
|
||||
co_return ContinueImmediately{};
|
||||
co_return StillAlive{};
|
||||
} catch (...) {
|
||||
co_return std::current_exception();
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ try {
|
|||
waiteeDone(dep);
|
||||
|
||||
if (dep->exitCode == ecFailed && !settings.keepGoing) {
|
||||
co_return result::success(ContinueImmediately{});
|
||||
co_return result::success(StillAlive{});
|
||||
}
|
||||
}
|
||||
|
||||
co_return result::success(ContinueImmediately{});
|
||||
co_return result::success(StillAlive{});
|
||||
} catch (...) {
|
||||
co_return result::failure(std::current_exception());
|
||||
}
|
||||
|
|
|
@ -103,7 +103,6 @@ public:
|
|||
struct Finished;
|
||||
|
||||
struct [[nodiscard]] StillAlive {};
|
||||
struct [[nodiscard]] ContinueImmediately {};
|
||||
struct [[nodiscard]] Finished {
|
||||
ExitCode exitCode;
|
||||
BuildResult result;
|
||||
|
@ -116,7 +115,6 @@ public:
|
|||
|
||||
struct [[nodiscard]] WorkResult : std::variant<
|
||||
StillAlive,
|
||||
ContinueImmediately,
|
||||
Finished>
|
||||
{
|
||||
WorkResult() = delete;
|
||||
|
|
|
@ -240,7 +240,7 @@ try {
|
|||
});
|
||||
|
||||
state = &PathSubstitutionGoal::finished;
|
||||
return pipe.promise.then([]() -> Result<WorkResult> { return ContinueImmediately{}; });
|
||||
return pipe.promise.then([]() -> Result<WorkResult> { return StillAlive{}; });
|
||||
} catch (...) {
|
||||
return {std::current_exception()};
|
||||
}
|
||||
|
|
|
@ -212,8 +212,7 @@ void Worker::handleWorkResult(GoalPtr goal, Goal::WorkResult how)
|
|||
{
|
||||
std::visit(
|
||||
overloaded{
|
||||
[&](Goal::StillAlive) {},
|
||||
[&](Goal::ContinueImmediately) { wakeUp(goal); },
|
||||
[&](Goal::StillAlive) { wakeUp(goal); },
|
||||
[&](Goal::Finished & f) { goalFinished(goal, f); },
|
||||
},
|
||||
how
|
||||
|
|
Loading…
Reference in a new issue