Skip to content

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

feat(memory): add has_pending to check for queued jobs

Steven Enamakel97bd52ce47ea
diff --git a/crates/openhuman-core/src/memory/lifecycle/jobs.rs b/crates/openhuman-core/src/memory/lifecycle/jobs.rs
index f37efa2b0c..740a2766a0 100644
--- a/crates/openhuman-core/src/memory/lifecycle/jobs.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/jobs.rs
@@ -166,6 +166,12 @@ pub async fn enqueue(config: &Config, root: &Namespace, jobs: Vec<BackgroundJob>
}
}
+/// Whether `workspace_dir` has queued jobs waiting. A cheap, lock-free read
+/// for a host deciding which workspaces are worth a run.
+pub fn has_pending(workspace_dir: &Path) -> bool {
+ !read(workspace_dir).pending.is_empty()
+}
+
/// The queue as it stands.
pub async fn snapshot(config: &Config) -> JobQueue {
let _guard = LOCK.lock().await;