use std::path::PathBuf;
use std::process::Command;
use std::time::Duration;
use crate::background_job::BackgroundJob;
use crate::workflow::Workflow;
impl Workflow {
pub fn run_in_background(&mut self, job_key: &str, max_age: Duration, cmd: Command) {
let mut job = BackgroundJob::new(self, job_key, max_age, cmd);
if let Some(item) = job.run() {
self.response.append_items(vec![item]);
self.response.rerun(Duration::from_secs(1));
}
}
pub fn jobs_dir(&self) -> PathBuf {
self.config.workflow_cache.join("jobs")
}
}