diff --git a/deepwell/src/services/job/mod.rs b/deepwell/src/services/job/mod.rs index 06155f5731f..f129f0f88f3 100644 --- a/deepwell/src/services/job/mod.rs +++ b/deepwell/src/services/job/mod.rs @@ -26,7 +26,8 @@ mod prelude { pub use super::super::prelude::*; pub use super::service::{ - JOB_QUEUE_DELAY, JOB_QUEUE_MAXIMUM_SIZE, JOB_QUEUE_NAME, JOB_QUEUE_PROCESS_TIME, + JobService, JOB_QUEUE_DELAY, JOB_QUEUE_MAXIMUM_SIZE, JOB_QUEUE_NAME, + JOB_QUEUE_PROCESS_TIME, }; pub use super::structs::*; } diff --git a/deepwell/src/services/job/worker.rs b/deepwell/src/services/job/worker.rs index bb5185b5115..c23b9fa919a 100644 --- a/deepwell/src/services/job/worker.rs +++ b/deepwell/src/services/job/worker.rs @@ -201,7 +201,17 @@ impl JobWorker { } }; - // XXX process 'next', queue job + // Add follow-up job to queue, if required. + match next { + NextJob::Done => debug!("Job execution finished, no follow-up job to add"), + NextJob::Next { job, delay } => { + debug!("Job execution finished, follow-up job has been produced"); + trace!("* Job: {job:?}"); + trace!("* Delay: {delay:?}"); + + JobService::queue_job(ctx, &job, delay).await?; + } + } trace!("Job execution finished, cleaning up"); self.rsmq.delete_message(JOB_QUEUE_NAME, &data.id).await?;