Check for new jobs when a job has been returned

This commit is contained in:
asonix 2018-11-06 21:44:24 -06:00
parent f92ae865a3
commit a142eb2d3f

View file

@ -127,12 +127,22 @@ fn process_jobs(
.fold( .fold(
(processors, num_processors), (processors, num_processors),
move |(processors, processor_count), msg| match msg { move |(processors, processor_count), msg| match msg {
ProcessorMessage::Job(job) => Either::A(return_job( ProcessorMessage::Job(job) => {
storage.clone(), let tx = tx.clone();
processor_count,
processors, Either::A(
job, return_job(storage.clone(), processor_count, processors, job).map(
)), move |values| {
tokio::spawn(
tx.send(ProcessorMessage::Time(tokio::clock::now()))
.map(|_| ())
.map_err(|_| ()),
);
values
},
),
)
}
ProcessorMessage::Time(_) => Either::B(Either::A(try_process_job( ProcessorMessage::Time(_) => Either::B(Either::A(try_process_job(
storage.clone(), storage.clone(),
processor_count, processor_count,