Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(cron): persist profile cron jobs across restarts

Steven Enamakele6ae6fa0302b
diff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rs
index 6fa33ff4aa..7251d991ed 100644
--- a/crates/openhuman-core/src/cron/store_tests.rs
+++ b/crates/openhuman-core/src/cron/store_tests.rs
@@ -112,9 +112,9 @@ async fn a_job_whose_agent_is_not_live_stays_dormant() {
.await;
drop(ctx);
- let mut dispatcher = crate::cron::scheduler::JobDispatcher::new(1);
- crate::cron::scheduler::tick_live_agents(&mut dispatcher).await;
- dispatcher.drain().await;
+ let mut agents = crate::cron::scheduler::LiveAgentSchedulers::default();
+ agents.tick().await;
+ agents.drain().await;
let after = CoreContext::scope(agent_context(&config, "dormant-agent"), async {
get_job(&config, &job.id).unwrap()
diff --git a/crates/openhuman-core/src/profiles/cron.rs b/crates/openhuman-core/src/profiles/cron.rs
index a79836f470..3ddfbea4c5 100644
--- a/crates/openhuman-core/src/profiles/cron.rs
+++ b/crates/openhuman-core/src/profiles/cron.rs
@@ -129,10 +129,10 @@ pub async fn sweep(host: &ProfileHost, now: DateTime<Utc>) -> SweepReport {
&profile_config.workspace_dir,
&profile_config.action_dir,
));
- let mut dispatcher = JobDispatcher::new(profile_config.scheduler.max_concurrent);
- dispatcher
- .dispatch(&profile_config, &security, claimed)
- .await;
+ let mut dispatcher = JobDispatcher::new(&profile_config, &security);
+ if let Err(error) = dispatcher.dispatch(claimed).await {
+ log::warn!("[profiles][cron] dispatch failed: {error}");
+ }
// Stop at once if the profile is fenced while its jobs run.
tokio::select! {
biased;