feat: add common queue
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
22
crates/churn/src/agent/scheduler.rs
Normal file
22
crates/churn/src/agent/scheduler.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
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(())
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user