fix: Temporary fix for #402

pull/404/head
Blaž Hrastnik 3 years ago
parent c68fe1f2a3
commit 83e7dd8602

@ -160,7 +160,11 @@ impl Application {
} }
self.render(); self.render();
} }
Some(callback) = self.jobs.next_job() => { Some(callback) = self.jobs.futures.next() => {
self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
self.render();
}
Some(callback) = self.jobs.wait_futures.next() => {
self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback); self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
self.render(); self.render();
} }

@ -16,9 +16,9 @@ pub struct Job {
#[derive(Default)] #[derive(Default)]
pub struct Jobs { pub struct Jobs {
futures: FuturesUnordered<JobFuture>, pub futures: FuturesUnordered<JobFuture>,
/// These are the ones that need to complete before we exit. /// These are the ones that need to complete before we exit.
wait_futures: FuturesUnordered<JobFuture>, pub wait_futures: FuturesUnordered<JobFuture>,
} }
impl Job { impl Job {
@ -77,11 +77,11 @@ impl Jobs {
} }
} }
pub fn next_job( pub async fn next_job(&mut self) -> Option<anyhow::Result<Option<Callback>>> {
&mut self, tokio::select! {
) -> impl Future<Output = Option<anyhow::Result<Option<Callback>>>> + '_ { event = self.futures.next() => { event }
future::select(self.futures.next(), self.wait_futures.next()) event = self.wait_futures.next() => { event }
.map(|either| either.factor_first().0) }
} }
pub fn add(&mut self, j: Job) { pub fn add(&mut self, j: Job) {

Loading…
Cancel
Save