Skip to content

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

test(dispatch): expose media lease dropping for testing

Steven Enamakel12f1009cebf6
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
index cbb559129d..5639663717 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
@@ -14,6 +14,9 @@ mod helpers;
pub(crate) mod host_agent;
mod native_runner;
mod processor;
+
+#[cfg(test)]
+pub(crate) use processor::drop_media_read_lease_for_test;
mod routing;
pub(crate) use processor::progressive::{
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
index a01180c66d..9853146806 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
@@ -21,6 +21,9 @@ pub(crate) mod progressive;
mod reset;
mod turn;
+#[cfg(test)]
+pub(crate) use native_media::drop_media_read_lease_for_test;
+
use crate::channels::context::ChannelRuntimeContext;
use std::sync::Arc;
use tinychannels_bus::{ChannelInboundEnvelope, ChannelMessage};
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media.rs
index c8c194ff63..8dd1a2f183 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media.rs
@@ -443,6 +443,15 @@ impl Drop for MediaReadLease {
}
}
+#[cfg(test)]
+pub(crate) fn drop_media_read_lease_for_test(
+ client: ModuleClient,
+ dispatch: DispatchCtx,
+ handle: tinychannels_bus::MediaReadHandle,
+) {
+ drop(MediaReadLease::new(client, dispatch, handle));
+}
+
#[cfg(test)]
#[path = "native_media_tests.rs"]
mod tests;