@@ -16,9 +16,9 @@ pub struct Job {
1616
1717#[derive(Default)]
1818pub struct Jobs {
19− futures: FuturesUnordered<JobFuture>,
19+ pub futures: FuturesUnordered<JobFuture>,
2020 /// These are the ones that need to complete before we exit.
21− wait_futures: FuturesUnordered<JobFuture>,
21+ pub wait_futures: FuturesUnordered<JobFuture>,
2222}
2323
2424impl Job {
@@ -77,11 +77,11 @@ impl Jobs {
7777 }
7878 }
7979
80− pub fn next_job(
81− &mut self,
82− ) -> impl Future<Output = Option<anyhow::Result<Option<Callback>>>> + '_ {
83− future::select(self.futures.next(), self.wait_futures.next())
84− .map(|either| either.factor_first().0)
80+ pub async fn next_job(&mut self) -> Option<anyhow::Result<Option<Callback>>> {
81+ tokio::select! {
82+ event = self.futures.next() => { event }
83+ event = self.wait_futures.next() => { event }
84+ }
8585 }
8686
8787 pub fn add(&mut self, j: Job) {