Improve and fix runner API

- The server now also signals abort_work if the commit is no longer in
  the queue.
- The server now immediately reserves the work it gives to the worker,
  so other idle workers won't get the same work.
- The server now chooses a run id, not the worker. The worker can still
  submit work under arbitrary run ids when no id is known, for example
  when importing runs from another database.
This commit is contained in:
Joscha 2023-08-12 13:19:16 +02:00
parent dd45be98a5
commit d15d6588f7
5 changed files with 68 additions and 53 deletions

View file

@ -161,7 +161,7 @@ impl Server {
assert!(!unfinished);
assert!(self.run.is_none());
let run = Arc::new(Mutex::new(Run::new(work.hash)));
let run = Arc::new(Mutex::new(Run::new(work.id, work.hash)));
let (abort_tx, abort_rx) = mpsc::unbounded_channel();
self.run = Some((run.clone(), abort_tx));