fix: prevent instrumentation to run in test mode
Some checks failed
Run Check Script / check (pull_request) Failing after 3s

This commit is contained in:
Ian Letourneau
2025-08-11 10:04:37 -04:00
parent 29a261575b
commit 8f8b82cda3
6 changed files with 31 additions and 13 deletions

View File

@@ -23,9 +23,18 @@ static HARMONY_COMPOSER_EVENT_BUS: Lazy<broadcast::Sender<HarmonyComposerEvent>>
});
pub fn instrument(event: HarmonyComposerEvent) -> Result<(), &'static str> {
match HARMONY_COMPOSER_EVENT_BUS.send(event) {
Ok(_) => Ok(()),
Err(_) => Err("send error: no subscribers"),
#[cfg(not(test))]
{
match HARMONY_COMPOSER_EVENT_BUS.send(event) {
Ok(_) => Ok(()),
Err(_) => Err("send error: no subscribers"),
}
}
#[cfg(test)]
{
let _ = event; // Suppress the "unused variable" warning for `event`
Ok(())
}
}