mirror of
https://git.asonix.dog/asonix/background-jobs.git
synced 2024-11-21 19:40:59 +00:00
Check for new jobs when a job has been returned
This commit is contained in:
parent
f92ae865a3
commit
a142eb2d3f
1 changed files with 16 additions and 6 deletions
|
@ -127,12 +127,22 @@ fn process_jobs(
|
|||
.fold(
|
||||
(processors, num_processors),
|
||||
move |(processors, processor_count), msg| match msg {
|
||||
ProcessorMessage::Job(job) => Either::A(return_job(
|
||||
storage.clone(),
|
||||
processor_count,
|
||||
processors,
|
||||
job,
|
||||
)),
|
||||
ProcessorMessage::Job(job) => {
|
||||
let tx = tx.clone();
|
||||
|
||||
Either::A(
|
||||
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(
|
||||
storage.clone(),
|
||||
processor_count,
|
||||
|
|
Loading…
Reference in a new issue