All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
23 lines
548 B
Rust
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(())
|
|
}
|
|
}
|