From 796bea74922e0e8ecf5adbde5cf92fc6507bb6eb Mon Sep 17 00:00:00 2001 From: kozabrada123 <59031733+kozabrada123@users.noreply.github.com> Date: Fri, 19 Jan 2024 15:31:40 +0100 Subject: [PATCH] right --- examples/gateway_observers.rs | 7 +++++-- examples/gateway_simple.rs | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/gateway_observers.rs b/examples/gateway_observers.rs index 5ea6506..b265dc5 100644 --- a/examples/gateway_observers.rs +++ b/examples/gateway_observers.rs @@ -11,7 +11,7 @@ use tokio::{self}; #[cfg(not(target_arch = "wasm32"))] use safina_timer::sleep_for; #[cfg(target_arch = "wasm32")] -use wasmtimer::tokio::sleep_for; +use wasmtimer::tokio::sleep; // This example creates a simple gateway connection and a basic observer struct @@ -65,6 +65,9 @@ async fn main() { // Do something on the main thread so we don't quit loop { - sleep_for(Duration::MAX).await + #[cfg(not(target_arch = "wasm32"))] + sleep_for(Duration::MAX).await; + #[cfg(target_arch = "wasm32")] + sleep(Duration::MAX).await; } } diff --git a/examples/gateway_simple.rs b/examples/gateway_simple.rs index de6bd5d..aaa0195 100644 --- a/examples/gateway_simple.rs +++ b/examples/gateway_simple.rs @@ -6,7 +6,7 @@ use chorus::{self, types::GatewayIdentifyPayload}; #[cfg(not(target_arch = "wasm32"))] use safina_timer::sleep_for; #[cfg(target_arch = "wasm32")] -use wasmtimer::tokio::sleep_for; +use wasmtimer::tokio::sleep; /// This example creates a simple gateway connection and a session with an Identify event #[tokio::main(flavor = "current_thread")] @@ -38,6 +38,9 @@ async fn main() { // Do something on the main thread so we don't quit loop { - sleep_for(Duration::MAX).await + #[cfg(not(target_arch = "wasm32"))] + sleep_for(Duration::MAX).await; + #[cfg(target_arch = "wasm32")] + sleep(Duration::MAX).await; } }