diff --git a/matrix_sdk/Cargo.toml b/matrix_sdk/Cargo.toml index 32d57fa10..9219005c6 100644 --- a/matrix_sdk/Cargo.toml +++ b/matrix_sdk/Cargo.toml @@ -46,7 +46,7 @@ path = "../matrix_sdk_base" default_features = false [dependencies.reqwest] -version = "0.10.10" +version = "0.11.0" default_features = false [dependencies.tracing-futures] @@ -58,9 +58,9 @@ features = ["std", "std-future"] futures-timer = "3.0.2" [target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio] -version = "0.2.24" +version = "1.0.1" default-features = false -features = ["fs", "blocking"] +features = ["fs", "rt"] [target.'cfg(target_arch = "wasm32")'.dependencies.futures-timer] version = "3.0.2" @@ -70,7 +70,7 @@ features = ["wasm-bindgen"] async-std = { version = "1.8.0", features = ["unstable"] } dirs = "3.0.1" matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" } -tokio = { version = "0.2.24", default-features = false, features = ["rt-threaded", "macros"] } +tokio = { version = "1.0.1", default-features = false, features = ["rt-multi-thread", "macros"] } serde_json = "1.0.61" tracing-subscriber = "0.2.15" tempfile = "3.1.0" diff --git a/matrix_sdk/examples/autojoin.rs b/matrix_sdk/examples/autojoin.rs index 94a513aa2..c8f376ee1 100644 --- a/matrix_sdk/examples/autojoin.rs +++ b/matrix_sdk/examples/autojoin.rs @@ -1,5 +1,5 @@ use std::{env, process::exit}; -use tokio::time::{delay_for, Duration}; +use tokio::time::{sleep, Duration}; use matrix_sdk::{ self, async_trait, @@ -45,7 +45,7 @@ impl EventEmitter for AutoJoinBot { delay ); - delay_for(Duration::from_secs(delay)).await; + sleep(Duration::from_secs(delay)).await; delay *= 2; if delay > 3600 { diff --git a/matrix_sdk_base/Cargo.toml b/matrix_sdk_base/Cargo.toml index 723a9f71c..5569c4487 100644 --- a/matrix_sdk_base/Cargo.toml +++ b/matrix_sdk_base/Cargo.toml @@ -39,7 +39,7 @@ sled = "0.34.6" futures = "0.3.8" [target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio] -version = "0.2.24" +version = "1.0.1" default-features = false features = ["sync", "fs"] @@ -56,7 +56,7 @@ clap = "2.33.3" syntect = "4.4.0" [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] -tokio = { version = "0.2.24", default-features = false, features = ["rt-threaded", "macros"] } +tokio = { version = "1.0.1", default-features = false, features = ["rt-multi-thread", "macros"] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.3.19" diff --git a/matrix_sdk_common/Cargo.toml b/matrix_sdk_common/Cargo.toml index 354879517..ca66ef11d 100644 --- a/matrix_sdk_common/Cargo.toml +++ b/matrix_sdk_common/Cargo.toml @@ -25,7 +25,7 @@ features = ["client-api", "unstable-pre-spec"] uuid = { version = "0.8.1", default-features = false, features = ["v4", "serde"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio] -version = "0.2.24" +version = "1.0.1" default-features = false features = ["sync"] diff --git a/matrix_sdk_crypto/Cargo.toml b/matrix_sdk_crypto/Cargo.toml index c59702d92..1d24c2088 100644 --- a/matrix_sdk_crypto/Cargo.toml +++ b/matrix_sdk_crypto/Cargo.toml @@ -48,7 +48,7 @@ default-features = false features = ["runtime-tokio-native-tls", "sqlite", "macros"] [dev-dependencies] -tokio = { version = "0.2.24", default-features = false, features = ["rt-threaded", "macros"] } +tokio = { version = "1.0.1", default-features = false, features = ["rt-multi-thread", "macros"] } futures = "0.3.8" proptest = "0.10.1" serde_json = "1.0.61" diff --git a/matrix_sdk_crypto/src/machine.rs b/matrix_sdk_crypto/src/machine.rs index 8b0c42fe6..a09b9fe4d 100644 --- a/matrix_sdk_crypto/src/machine.rs +++ b/matrix_sdk_crypto/src/machine.rs @@ -1772,7 +1772,7 @@ pub(crate) mod test { } } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] #[cfg(feature = "sqlite_cryptostore")] async fn test_machine_with_default_store() { let tmpdir = tempdir().unwrap(); diff --git a/matrix_sdk_crypto/src/store/sqlite.rs b/matrix_sdk_crypto/src/store/sqlite.rs index 6391028d9..bedbe4dd4 100644 --- a/matrix_sdk_crypto/src/store/sqlite.rs +++ b/matrix_sdk_crypto/src/store/sqlite.rs @@ -1985,7 +1985,7 @@ mod test { (alice, session) } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn create_store() { let tmpdir = tempdir().unwrap(); let tmpdir_path = tmpdir.path().to_str().unwrap(); @@ -1994,7 +1994,7 @@ mod test { .expect("Can't create store"); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn save_account() { let (store, _dir) = get_store(None).await; assert!(store.load_account().await.unwrap().is_none()); @@ -2006,7 +2006,7 @@ mod test { .expect("Can't save account"); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn load_account() { let (store, _dir) = get_store(None).await; let account = get_account(); @@ -2022,7 +2022,7 @@ mod test { assert_eq!(account, loaded_account); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn load_account_with_passphrase() { let (store, _dir) = get_store(Some("secret_passphrase")).await; let account = get_account(); @@ -2038,7 +2038,7 @@ mod test { assert_eq!(account, loaded_account); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn save_and_share_account() { let (store, _dir) = get_store(None).await; let account = get_account(); @@ -2066,7 +2066,7 @@ mod test { ); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn save_session() { let (store, _dir) = get_store(None).await; let (account, session) = get_account_and_session().await; @@ -2081,7 +2081,7 @@ mod test { store.save_sessions(&[session]).await.unwrap(); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn load_sessions() { let (store, _dir) = get_store(None).await; let (account, session) = get_account_and_session().await; @@ -2100,7 +2100,7 @@ mod test { assert_eq!(&session, loaded_session); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn add_and_save_session() { let (store, dir) = get_store(None).await; let (account, session) = get_account_and_session().await; @@ -2135,7 +2135,7 @@ mod test { assert_eq!(session_id, session.session_id()); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn save_inbound_group_session() { let (account, store, _dir) = get_loaded_store().await; @@ -2155,7 +2155,7 @@ mod test { .expect("Can't save group session"); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn load_inbound_group_session() { let (account, store, dir) = get_loaded_store().await; @@ -2196,7 +2196,7 @@ mod test { assert!(!export.forwarding_curve25519_key_chain.is_empty()) } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn test_tracked_users() { let (_account, store, dir) = get_loaded_store().await; let device = get_device(); @@ -2243,7 +2243,7 @@ mod test { assert!(!store.users_for_key_query().contains(device.user_id())); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn device_saving() { let (_account, store, dir) = get_loaded_store().await; let device = get_device(); @@ -2285,7 +2285,7 @@ mod test { assert_eq!(user_devices.values().next().unwrap(), &device); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn device_deleting() { let (_account, store, dir) = get_loaded_store().await; let device = get_device(); @@ -2324,7 +2324,7 @@ mod test { assert!(loaded_device.is_none()); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn user_saving() { let dir = tempdir().unwrap(); let tmpdir_path = dir.path().to_str().unwrap(); @@ -2419,7 +2419,7 @@ mod test { assert!(loaded_user.own().unwrap().is_verified()) } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn private_identity_saving() { let (_, store, _dir) = get_loaded_store().await; assert!(store.load_identity().await.unwrap().is_none()); @@ -2435,7 +2435,7 @@ mod test { assert_eq!(identity.user_id(), loaded_identity.user_id()); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn key_value_saving() { let (_, store, _dir) = get_loaded_store().await; let key = "test_key".to_string(); @@ -2450,7 +2450,7 @@ mod test { assert!(store.get_value(&key).await.unwrap().is_none()); } - #[tokio::test(threaded_scheduler)] + #[tokio::test(flavor = "multi_thread")] async fn olm_hash_saving() { let (_, store, _dir) = get_loaded_store().await;