so what are these? auto gc and typed observation (because some flett shit is depending on ts)

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
lda
2026-05-01 19:25:03 +07:00
co-authored by Copilot
Verified
parent b5c0626250
commit b5a28c801c
39 changed files with 874 additions and 327 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ async fn dispatch_inventory(req: InventoryRequest, config: &AgentConfig) -> Resu
&config.mac_name_cache_path,
)
.await?;
let observations = match wakey::wakey_linux::dhcp::list_local_observations_from_path(
let observations = match wakey::wakey_linux::observations::list_local_observations_from_path(
&config.observation_store_path,
)
.await
+19 -4
View File
@@ -185,6 +185,13 @@ async fn send_agent_observations(client: &reqwest::Client, config: &AgentConfig)
.unwrap_or_else(|_| "<unreadable error body>".to_string());
anyhow::bail!("observation upload failed with {status}: {body}");
}
if let Err(err) = wakey::wakey_linux::observations::prune_removed_observations_from_path(
&config.observation_store_path,
)
.await
{
warn!(agent_id = %config.agent_id, error = %err, "failed to prune removed observations after upload");
}
debug!(
agent_id = %config.agent_id,
observations = payload.observations.len(),
@@ -211,15 +218,23 @@ where
},
)
.await?;
if let Err(err) = wakey::wakey_linux::observations::prune_removed_observations_from_path(
&config.observation_store_path,
)
.await
{
warn!(agent_id = %config.agent_id, error = %err, "failed to prune removed observations after websocket send");
}
debug!(agent_id = %config.agent_id, observations = count, "sent observations over websocket");
Ok(count)
}
async fn load_agent_observations(config: &AgentConfig) -> Result<Vec<AgentObservation>> {
let observations =
wakey::wakey_linux::dhcp::list_local_observations_from_path(&config.observation_store_path)
.await
.context("failed to read local observations")?;
let observations = wakey::wakey_linux::observations::list_local_observations_from_path(
&config.observation_store_path,
)
.await
.context("failed to read local observations")?;
Ok(observations
.into_iter()
.map(|observation| AgentObservation {