Skip to content

Commit

Permalink
Tiny refactor in main runloop
Browse files Browse the repository at this point in the history
This is no functional change, it just reorders the run/no-run blocks to
reduce indentation.

This will make my next PR easier to read.
  • Loading branch information
cmyr committed Jul 13, 2023
1 parent 30a0270 commit 580f2b8
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions fontc/src/workload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,28 +212,28 @@ impl<'a> Workload<'a> {
.work
.take()
.expect("{id:?} ready to run but has no work?!");
if job.run {
let work_context = AnyContext::for_work(
fe_root,
be_root,
&id,
job.read_access.clone(),
job.write_access.clone(),
);

scope.spawn(move |_| {
let result = work.exec(work_context);
if let Err(e) = send.send((id.clone(), result)) {
log::error!(
"Unable to write {:?} to completion channel: {}",
id,
e
);
}
})
} else if let Err(e) = send.send((id.clone(), Ok(()))) {
log::error!("Unable to write nop {:?} to completion channel: {}", id, e);
if !job.run {
if let Err(e) = send.send((id.clone(), Ok(()))) {
log::error!("Unable to write nop {id:?} to completion channel: {e}");
//FIXME: if we can't send messages it means the receiver has dropped,
//which means we should... return? abort?
}
continue;
}
let work_context = AnyContext::for_work(
fe_root,
be_root,
&id,
job.read_access.clone(),
job.write_access.clone(),
);

scope.spawn(move |_| {
let result = work.exec(work_context);
if let Err(e) = send.send((id.clone(), result)) {
log::error!("Unable to write {id:?} to completion channel: {e}");
}
})
}

// Block for things to phone home to say they are done
Expand Down

0 comments on commit 580f2b8

Please sign in to comment.