churn-v2/crates/churn/src/agent/scheduler.rs
kjuulh ea5adb2f93
All checks were successful
continuous-integration/drone/push Build is passing
feat: add common queue
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-11-24 21:08:37 +01:00

23 lines
548 B
Rust

use super::{handlers::scheduled_tasks::ScheduledTasks, models::Commands};
#[derive(Clone)]
pub struct Scheduler {
scheduled_tasks: ScheduledTasks,
}
impl Scheduler {
pub fn new(scheduled_tasks: ScheduledTasks) -> Self {
Self { scheduled_tasks }
}
pub async fn handle(&self, command: Commands) -> anyhow::Result<()> {
match command {
Commands::ScheduleTask { task, properties } => {
self.scheduled_tasks.handle(&task, properties).await?;
}
}
Ok(())
}
}