Watch
0
0
Fork
You've already forked hyperhive
0

hive-c0re/swarm-*: drop clippy allows and dedupe unix_now + KV open_or_create

No behaviour change. Casts replaced by try_from / Duration math; schedules.rs
reuses agent_renewal::unix_now; the five swarm-queue-client KV open-or-create
copies share one private kv::open_or_create.
This commit is contained in:
atlas 2026-10-09 09:48:03 +02:00 • committed by mara
commit b874d21cda
11 changed files with 74 additions and 133 deletions

View file

@ -97,28 +97,13 @@ pub async fn open_or_create(
client: &async_nats::Client,
) -> Result<async_nats::jetstream::kv::Store, crate::Error> {
let js = async_nats::jetstream::new(client.clone());
match js.get_key_value(BUCKET).await {
Ok(store) => Ok(store),
Err(e) => {
tracing::info!(
bucket = BUCKET,
reason = %e,
"agent-schedule bucket not available, creating it"
);
js.create_key_value(async_nats::jetstream::kv::Config {
bucket: BUCKET.to_owned(),
description: "Scheduled prompts the swarm controller declares for each agent"
.to_owned(),
history: 1,
..Default::default()
})
.await
.map_err(|source| crate::Error::CreateBucket {
bucket: BUCKET.to_owned(),
source,
})
}
}
crate::kv::open_or_create(
&js,
BUCKET,
"agent-schedule",
"Scheduled prompts the swarm controller declares for each agent".to_owned(),
)
.await
}
/// What reading one agent's key found.