From 55a810d61b80fd619b4bf1a4785d609438ff635d Mon Sep 17 00:00:00 2001 From: Ankur Srivastava Date: Wed, 20 Apr 2022 15:04:20 +0200 Subject: [PATCH] WIP: initial cron impl --- src/app.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/app.rs b/src/app.rs index e67fa44..48514d5 100755 --- a/src/app.rs +++ b/src/app.rs @@ -596,6 +596,23 @@ where let service_handles = join_all(services); + let crons: Vec> = self + .cronjobs + .iter() + .map(|(tid, task)| { + info!("Starting Task with ID: {}", tid); + // TODO: Recovery should be here. + nuclei::spawn(async move { + match task.start().await { + Ok(dep) => dep.await, + _ => panic!("Error occurred on start of Task with ID: {}.", tid), + } + }) + }) + .collect(); + + let cron_handles = join_all(crons); + let tasks: Vec> = self .tasks .iter()