Skip to content

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

refactor(profiles): spawn heartbeat renewals through scoped task handle

Steven Enamakelece7c0878f4b
diff --git a/crates/openhuman-core/src/profiles/lease.rs b/crates/openhuman-core/src/profiles/lease.rs
index 3f7fc03d28..5a1d240f38 100644
--- a/crates/openhuman-core/src/profiles/lease.rs
+++ b/crates/openhuman-core/src/profiles/lease.rs
@@ -167,7 +167,7 @@ pub async fn renew_once(host: &ProfileHost) -> HeartbeatReport {
/// the operator context. Runs until the process exits.
pub fn heartbeat(host: Arc<ProfileHost>, operator: Arc<crate::core::runtime::CoreContext>) {
let every = renew_interval(host.saas().lease_ttl());
- crate::core::runtime::spawn_scoped_in(operator, async move {
+ let renewals = crate::core::runtime::CoreContext::scope(operator, async move {
log::info!(
"[profiles][lease] heartbeat started every_ms={}",
every.as_millis()
@@ -186,6 +186,7 @@ pub fn heartbeat(host: Arc<ProfileHost>, operator: Arc<crate::core::runtime::Cor
}
}
});
+ crate::core::runtime::spawn_scoped(renewals);
}
#[cfg(test)]