Skip to content

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

style(cron): apply rustfmt formatting to scheduler code

Steven Enamakel6a19308922fe
diff --git a/crates/openhuman-core/src/cron/job_builder_tests.rs b/crates/openhuman-core/src/cron/job_builder_tests.rs
index e85c97777e..cbe313da70 100644
--- a/crates/openhuman-core/src/cron/job_builder_tests.rs
+++ b/crates/openhuman-core/src/cron/job_builder_tests.rs
@@ -122,9 +122,15 @@ fn announce_to_origin_reply_target_skips_allowed_users() {
mention_only: false,
});
// Chat id 42 is not in allowed_users (a username), but it is the asker.
- assert!(validate_delivery_for_config(&cfg, &announce("telegram", "42"), Some(&channel())).is_ok());
+ assert!(
+ validate_delivery_for_config(&cfg, &announce("telegram", "42"), Some(&channel())).is_ok()
+ );
// Without the origin, or for another target, the allowlist still applies.
assert!(validate_delivery_for_config(&cfg, &announce("telegram", "42"), None).is_err());
- assert!(validate_delivery_for_config(&cfg, &announce("telegram", "99"), Some(&channel())).is_err());
- assert!(validate_delivery_for_config(&cfg, &announce("discord", "42"), Some(&channel())).is_err());
+ assert!(
+ validate_delivery_for_config(&cfg, &announce("telegram", "99"), Some(&channel())).is_err()
+ );
+ assert!(
+ validate_delivery_for_config(&cfg, &announce("discord", "42"), Some(&channel())).is_err()
+ );
}
diff --git a/crates/openhuman-core/src/cron/scheduler/host.rs b/crates/openhuman-core/src/cron/scheduler/host.rs
index bb19353c4c..70be14fea1 100644
--- a/crates/openhuman-core/src/cron/scheduler/host.rs
+++ b/crates/openhuman-core/src/cron/scheduler/host.rs
@@ -101,7 +101,9 @@ impl JobStore for HostStore {
self.binding
.within(async {
let config = self.binding.config();
- let jobs = crate::cron::store::documents(&config)?.due_jobs(now).await?;
+ let jobs = crate::cron::store::documents(&config)?
+ .due_jobs(now)
+ .await?;
Ok(self.keep_runnable(&config, jobs))
})
.await
diff --git a/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs
index db973bac38..a9f1d975e5 100644
--- a/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs
@@ -459,7 +459,11 @@ async fn scheduler_tick_once_publishes_health_recovery_signal_on_empty_queue() {
// transition and fires the recovery event — same shape as `run()`
// immediately after boot.
let mut last_emitted_health: Option<bool> = None;
- tick_once(&config, &mut last_emitted_health, &mut JobDispatcher::new(&config, &security))
+ tick_once(
+ &config,
+ &mut last_emitted_health,
+ &mut JobDispatcher::new(&config, &security),
+ )
.await;
// Bus delivery is async — wait briefly for the subscriber to drain.
@@ -518,7 +522,11 @@ async fn scheduler_tick_once_does_not_re_emit_recovery_signal_on_steady_state()
let mut last_emitted_health: Option<bool> = None;
// First tick: transition from None → Some(true), publishes once.
- tick_once(&config, &mut last_emitted_health, &mut JobDispatcher::new(&config, &security))
+ tick_once(
+ &config,
+ &mut last_emitted_health,
+ &mut JobDispatcher::new(&config, &security),
+ )
.await;
assert_eq!(
last_emitted_health,
@@ -532,7 +540,11 @@ async fn scheduler_tick_once_does_not_re_emit_recovery_signal_on_steady_state()
// Some(true)` guard inside `tick_once` short-circuited and no
// `publish_global` call ran on those ticks.
for tick in 2..=5 {
- tick_once(&config, &mut last_emitted_health, &mut JobDispatcher::new(&config, &security))
+ tick_once(
+ &config,
+ &mut last_emitted_health,
+ &mut JobDispatcher::new(&config, &security),
+ )
.await;
assert_eq!(
last_emitted_health,
diff --git a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
index 3fe0d2c23c..7c82ef3e07 100644
--- a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
@@ -3,13 +3,13 @@
//! are honoured and a system job's handler result is what gets recorded.
use super::*;
-use tinyflows_schedule::JobPolicy;
use crate::cron::system_job_handlers::{register, SystemJobContext};
use crate::cron::system_jobs::ensure_system_job;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::Duration;
use tempfile::TempDir;
use tinyflows_schedule::types::Schedule;
+use tinyflows_schedule::JobPolicy;
/// Stores `policy` on the job.
fn set_policy(config: &Config, job_id: &str, policy: JobPolicy) -> anyhow::Result<()> {
@@ -171,10 +171,7 @@ async fn dispatch_claims_the_slot_so_a_running_job_is_not_due_again() {
);
let job = due_system_job(&config, "dispatch-claim");
let mut dispatcher = JobDispatcher::new(&config, &security(&config));
- dispatcher
- .dispatch(vec![job.clone()])
- .await
- .unwrap();
+ dispatcher.dispatch(vec![job.clone()]).await.unwrap();
let stored = cron::get_job(&config, &job.id).unwrap();
assert!(stored.next_run > Utc::now(), "the running slot is claimed");
assert!(cron::due_jobs(&config, Utc::now())
@@ -194,10 +191,7 @@ async fn a_job_already_in_flight_is_not_dispatched_again() {
let job = due_system_job(&config, "dispatch-dedupe");
let running = crate::cron::ops::try_acquire_run(&job.id).expect("the job is free");
let mut dispatcher = JobDispatcher::new(&config, &security(&config));
- dispatcher
- .dispatch(vec![job.clone()])
- .await
- .unwrap();
+ dispatcher.dispatch(vec![job.clone()]).await.unwrap();
dispatcher.drain().await;
drop(running);
assert_eq!(calls.load(Ordering::SeqCst), 0);
@@ -226,10 +220,7 @@ async fn a_single_flight_job_records_the_missed_slot_as_skipped() {
let job = cron::get_job(&config, &job.id).unwrap();
let running = crate::cron::ops::try_acquire_run(&job.id).expect("the job is free");
let mut dispatcher = JobDispatcher::new(&config, &security(&config));
- dispatcher
- .dispatch(vec![job.clone()])
- .await
- .unwrap();
+ dispatcher.dispatch(vec![job.clone()]).await.unwrap();
dispatcher.drain().await;
drop(running);
@@ -315,10 +306,7 @@ async fn a_system_job_handler_error_is_recorded_as_the_run_result() {
.unwrap();
let job = cron::get_job(&config, &job.id).unwrap();
let mut dispatcher = JobDispatcher::new(&config, &security(&config));
- dispatcher
- .dispatch(vec![job.clone()])
- .await
- .unwrap();
+ dispatcher.dispatch(vec![job.clone()]).await.unwrap();
dispatcher.drain().await;
let stored = cron::get_job(&config, &job.id).unwrap();
assert_eq!(stored.last_status.as_deref(), Some("error"));
@@ -392,7 +380,11 @@ async fn an_upgraded_job_with_a_side_table_policy_keeps_firing_with_it() {
dispatcher.drain().await;
let after = cron::get_job(&config, shell_id).unwrap();
- assert_eq!(after.last_status.as_deref(), Some("ok"), "the upgraded job ran");
+ assert_eq!(
+ after.last_status.as_deref(),
+ Some("ok"),
+ "the upgraded job ran"
+ );
assert!(after.policy.single_flight, "its policy survived the run");
}