Use spawn_local instead of tokio::spawn on WebAssembly (#1595)

This commit is contained in:
Rushmore Mushambi 2023-01-14 21:56:40 +02:00 committed by GitHub
parent 7f927d77aa
commit 63ba510b09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,6 +22,10 @@ use std::future::IntoFuture;
use std::marker::PhantomData;
use std::pin::Pin;
use std::sync::Arc;
#[cfg(not(target_arch = "wasm32"))]
use tokio::spawn;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_futures::spawn_local as spawn;
/// A specialized `Result` type
pub type Result<T> = std::result::Result<T, crate::Error>;
@ -140,7 +144,7 @@ where
{
fn check_server_version(&self) {
let conn = self.clone();
tokio::spawn(async move {
spawn(async move {
let (versions, build_meta) = SUPPORTED_VERSIONS;
// invalid version requirements should be caught during development
let req = VersionReq::parse(versions).expect("valid supported versions");