forked from lix-project/lix
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> {
|
return p.then([](auto r) -> Result<WorkResult> {
|
||||||
if (r.has_value()) {
|
if (r.has_value()) {
|
||||||
return ContinueImmediately{};
|
return StillAlive{};
|
||||||
} else if (r.has_error()) {
|
} else if (r.has_error()) {
|
||||||
return r.assume_error();
|
return r.assume_error();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -86,7 +86,7 @@ try {
|
||||||
});
|
});
|
||||||
|
|
||||||
state = &DrvOutputSubstitutionGoal::realisationFetched;
|
state = &DrvOutputSubstitutionGoal::realisationFetched;
|
||||||
return pipe.promise.then([]() -> Result<WorkResult> { return ContinueImmediately{}; });
|
return pipe.promise.then([]() -> Result<WorkResult> { return StillAlive{}; });
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return {std::current_exception()};
|
return {std::current_exception()};
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ try {
|
||||||
/* If we are polling goals that are waiting for a lock, then wake
|
/* If we are polling goals that are waiting for a lock, then wake
|
||||||
up after a few seconds at most. */
|
up after a few seconds at most. */
|
||||||
co_await worker.aio.provider->getTimer().afterDelay(settings.pollInterval.get() * kj::SECONDS);
|
co_await worker.aio.provider->getTimer().afterDelay(settings.pollInterval.get() * kj::SECONDS);
|
||||||
co_return ContinueImmediately{};
|
co_return StillAlive{};
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
co_return std::current_exception();
|
co_return std::current_exception();
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,11 @@ try {
|
||||||
waiteeDone(dep);
|
waiteeDone(dep);
|
||||||
|
|
||||||
if (dep->exitCode == ecFailed && !settings.keepGoing) {
|
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 (...) {
|
} catch (...) {
|
||||||
co_return result::failure(std::current_exception());
|
co_return result::failure(std::current_exception());
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,6 @@ public:
|
||||||
struct Finished;
|
struct Finished;
|
||||||
|
|
||||||
struct [[nodiscard]] StillAlive {};
|
struct [[nodiscard]] StillAlive {};
|
||||||
struct [[nodiscard]] ContinueImmediately {};
|
|
||||||
struct [[nodiscard]] Finished {
|
struct [[nodiscard]] Finished {
|
||||||
ExitCode exitCode;
|
ExitCode exitCode;
|
||||||
BuildResult result;
|
BuildResult result;
|
||||||
|
@ -116,7 +115,6 @@ public:
|
||||||
|
|
||||||
struct [[nodiscard]] WorkResult : std::variant<
|
struct [[nodiscard]] WorkResult : std::variant<
|
||||||
StillAlive,
|
StillAlive,
|
||||||
ContinueImmediately,
|
|
||||||
Finished>
|
Finished>
|
||||||
{
|
{
|
||||||
WorkResult() = delete;
|
WorkResult() = delete;
|
||||||
|
|
|
@ -240,7 +240,7 @@ try {
|
||||||
});
|
});
|
||||||
|
|
||||||
state = &PathSubstitutionGoal::finished;
|
state = &PathSubstitutionGoal::finished;
|
||||||
return pipe.promise.then([]() -> Result<WorkResult> { return ContinueImmediately{}; });
|
return pipe.promise.then([]() -> Result<WorkResult> { return StillAlive{}; });
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return {std::current_exception()};
|
return {std::current_exception()};
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,8 +212,7 @@ void Worker::handleWorkResult(GoalPtr goal, Goal::WorkResult how)
|
||||||
{
|
{
|
||||||
std::visit(
|
std::visit(
|
||||||
overloaded{
|
overloaded{
|
||||||
[&](Goal::StillAlive) {},
|
[&](Goal::StillAlive) { wakeUp(goal); },
|
||||||
[&](Goal::ContinueImmediately) { wakeUp(goal); },
|
|
||||||
[&](Goal::Finished & f) { goalFinished(goal, f); },
|
[&](Goal::Finished & f) { goalFinished(goal, f); },
|
||||||
},
|
},
|
||||||
how
|
how
|
||||||
|
|
Loading…
Reference in a new issue