diff options
author | eldritch horrors <pennae@lix.systems> | 2024-10-20 22:55:00 +0200 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-10-23 11:55:12 +0000 |
commit | 5f1344dd8aec59ce654a0fac30b1842e2e68299c (patch) | |
tree | 01e1205ec85556983b33ca5bc596703330570071 /src/libstore/build/worker.cc | |
parent | faee771b302dc2871e3a91e3797cf1417416ce43 (diff) |
libstore: turn Worker::run into a promise
a first little step into pushing the event loops up, up and away.
eventually we will want them to be instantiated only at the roots
of every thread (since kj binds loops to threads), but not today.
Change-Id: Ic97f1debba382a5a3f46daeaf2d6d434ee42569f
Diffstat (limited to 'src/libstore/build/worker.cc')
-rw-r--r-- | src/libstore/build/worker.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 1cb4a6090..2a764b193 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -229,8 +229,8 @@ try { co_return result::failure(std::current_exception()); } -Worker::Results Worker::run(std::function<Targets (GoalFactory &)> req) -{ +kj::Promise<Result<Worker::Results>> Worker::run(std::function<Targets (GoalFactory &)> req) +try { auto topGoals = req(goalFactory()); assert(!running); @@ -252,7 +252,9 @@ Worker::Results Worker::run(std::function<Targets (GoalFactory &)> req) promise = promise.exclusiveJoin(boopGC(*localStore)); } - return promise.wait(aio.waitScope).value(); + co_return co_await promise; +} catch (...) { + co_return result::failure(std::current_exception()); } kj::Promise<Result<Worker::Results>> Worker::runImpl(Targets topGoals) |