feat: add abstraction around task
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:
@@ -1,6 +1,9 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::agent::actions::Plan;
|
||||
use crate::agent::{
|
||||
actions::Plan,
|
||||
task::{ConcreteTask, IntoTask},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ScheduledTasks {}
|
||||
@@ -17,7 +20,12 @@ impl ScheduledTasks {
|
||||
tracing::info!("scheduling: {}", task);
|
||||
|
||||
let plan = Plan::new();
|
||||
let tasks = plan.tasks().await?;
|
||||
let tasks: Vec<ConcreteTask> = plan
|
||||
.tasks()
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(|i| i.into_task())
|
||||
.collect();
|
||||
|
||||
for task in tasks {
|
||||
if !task.should_run().await? {
|
||||
|
Reference in New Issue
Block a user