From 6647bb89be1fa2a300358658824da3f6d5406771 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 24 Nov 2024 21:24:50 +0100 Subject: [PATCH] feat: add queue Signed-off-by: kjuulh --- crates/churn/src/agent/agent_state.rs | 8 ++------ crates/churn/src/agent/handlers/scheduled_tasks.rs | 2 ++ crates/churn/src/agent/queue.rs | 2 +- crates/churn/src/agent/refresh.rs | 2 -- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/crates/churn/src/agent/agent_state.rs b/crates/churn/src/agent/agent_state.rs index 4e86669..ef71702 100644 --- a/crates/churn/src/agent/agent_state.rs +++ b/crates/churn/src/agent/agent_state.rs @@ -3,12 +3,8 @@ use std::{ops::Deref, sync::Arc}; use crate::api::Discovery; use super::{ - config::AgentConfig, - discovery_client::DiscoveryClient, - grpc_client::GrpcClient, - handlers::scheduled_tasks::{self, ScheduledTasks}, - queue::AgentQueue, - scheduler::Scheduler, + config::AgentConfig, discovery_client::DiscoveryClient, grpc_client::GrpcClient, + handlers::scheduled_tasks::ScheduledTasks, queue::AgentQueue, scheduler::Scheduler, }; #[derive(Clone)] diff --git a/crates/churn/src/agent/handlers/scheduled_tasks.rs b/crates/churn/src/agent/handlers/scheduled_tasks.rs index 574f46c..48df8e2 100644 --- a/crates/churn/src/agent/handlers/scheduled_tasks.rs +++ b/crates/churn/src/agent/handlers/scheduled_tasks.rs @@ -14,6 +14,8 @@ impl ScheduledTasks { task: &str, _properties: BTreeMap, ) -> anyhow::Result<()> { + tracing::info!("scheduling: {}", task); + // Get plan let plan = Plan::new(); let tasks = plan.tasks().await?; diff --git a/crates/churn/src/agent/queue.rs b/crates/churn/src/agent/queue.rs index 2ea9e72..305b427 100644 --- a/crates/churn/src/agent/queue.rs +++ b/crates/churn/src/agent/queue.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use notmad::{Component, MadError}; use tokio::sync::Mutex; -use super::{handlers::scheduled_tasks::ScheduledTasks, models::Commands, scheduler::Scheduler}; +use super::{models::Commands, scheduler::Scheduler}; #[derive(Clone)] pub struct AgentQueue { diff --git a/crates/churn/src/agent/refresh.rs b/crates/churn/src/agent/refresh.rs index e87d4d7..79c271b 100644 --- a/crates/churn/src/agent/refresh.rs +++ b/crates/churn/src/agent/refresh.rs @@ -1,7 +1,5 @@ use std::collections::BTreeMap; -use anyhow::Context; - use crate::agent::models::Commands; use super::{agent_state::AgentState, queue::AgentQueue};