diff --git a/Cargo.lock b/Cargo.lock index 1dc6cda..9e4e135 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -221,7 +221,6 @@ dependencies = [ "reqwest", "rustls", "rustls-native-certs", - "safina-timer", "serde", "serde-aux", "serde_json", @@ -1689,15 +1688,6 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" -[[package]] -name = "safina-timer" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1081a264d1a3e81b75c4bcd5696094fb6ce470c2ded14cbd47bcb5229079b9df" -dependencies = [ - "once_cell", -] - [[package]] name = "schannel" version = "0.1.23" diff --git a/Cargo.toml b/Cargo.toml index eff3453..bc1eb18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,6 @@ tokio-tungstenite = { version = "0.20.1", features = [ ] } native-tls = "0.2.11" hostname = "0.3.1" -safina-timer = "0.1.11" [target.'cfg(target_arch = "wasm32")'.dependencies] getrandom = { version = "0.2.12", features = ["js"] } diff --git a/examples/gateway_observers.rs b/examples/gateway_observers.rs index b265dc5..a26ecfb 100644 --- a/examples/gateway_observers.rs +++ b/examples/gateway_observers.rs @@ -9,7 +9,7 @@ use std::{sync::Arc, time::Duration}; use tokio::{self}; #[cfg(not(target_arch = "wasm32"))] -use safina_timer::sleep_for; +use tokio::time::sleep; #[cfg(target_arch = "wasm32")] use wasmtimer::tokio::sleep; @@ -60,14 +60,8 @@ async fn main() { 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 { - #[cfg(not(target_arch = "wasm32"))] - sleep_for(Duration::MAX).await; - #[cfg(target_arch = "wasm32")] - sleep(Duration::MAX).await; + sleep(Duration::from_secs(3600)).await; } } diff --git a/examples/gateway_simple.rs b/examples/gateway_simple.rs index aaa0195..affa850 100644 --- a/examples/gateway_simple.rs +++ b/examples/gateway_simple.rs @@ -4,7 +4,7 @@ use chorus::gateway::Gateway; use chorus::{self, types::GatewayIdentifyPayload}; #[cfg(not(target_arch = "wasm32"))] -use safina_timer::sleep_for; +use tokio::time::sleep; #[cfg(target_arch = "wasm32")] use wasmtimer::tokio::sleep; @@ -33,14 +33,8 @@ async fn main() { // Send off the event 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 { - #[cfg(not(target_arch = "wasm32"))] - sleep_for(Duration::MAX).await; - #[cfg(target_arch = "wasm32")] - sleep(Duration::MAX).await; + sleep(Duration::from_secs(3600)).await; } } diff --git a/src/gateway/heartbeat.rs b/src/gateway/heartbeat.rs index 2204113..8e37697 100644 --- a/src/gateway/heartbeat.rs +++ b/src/gateway/heartbeat.rs @@ -2,12 +2,12 @@ use futures_util::SinkExt; use log::*; #[cfg(not(target_arch = "wasm32"))] -use std::time::Instant; +use tokio::time::Instant; #[cfg(target_arch = "wasm32")] use wasmtimer::std::Instant; #[cfg(not(target_arch = "wasm32"))] -use safina_timer::sleep_until; +use tokio::time::sleep_until; #[cfg(target_arch = "wasm32")] use wasmtimer::tokio::sleep_until; @@ -72,9 +72,6 @@ impl HeartbeatHandler { let mut last_heartbeat_acknowledged = true; let mut last_seq_number: Option = None; - #[cfg(not(target_arch = "wasm32"))] - safina_timer::start_timer_thread(); - loop { if kill_receive.try_recv().is_ok() { trace!("GW: Closing heartbeat task");