From 85602de91cfb5ecbe5d60c8872b763af6d1ed3db Mon Sep 17 00:00:00 2001 From: kozabrada123 <59031733+kozabrada123@users.noreply.github.com> Date: Fri, 19 Jan 2024 15:14:50 +0100 Subject: [PATCH] fix tests --- examples/gateway_observers.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/gateway_observers.rs b/examples/gateway_observers.rs index a13c935..5ea6506 100644 --- a/examples/gateway_observers.rs +++ b/examples/gateway_observers.rs @@ -8,6 +8,11 @@ use chorus::{ use std::{sync::Arc, time::Duration}; use tokio::{self}; +#[cfg(not(target_arch = "wasm32"))] +use safina_timer::sleep_for; +#[cfg(target_arch = "wasm32")] +use wasmtimer::tokio::sleep_for; + // This example creates a simple gateway connection and a basic observer struct // Due to certain limitations all observers must impl debug @@ -54,10 +59,12 @@ async fn main() { let mut identify = GatewayIdentifyPayload::common(); identify.token = token; gateway.send_identify(identify).await; + + #[cfg(not(target_arch = "wasm32"))] safina_timer::start_timer_thread(); // Do something on the main thread so we don't quit loop { - safina_timer::sleep_for(Duration::MAX).await + sleep_for(Duration::MAX).await } }