matrix-sdk: Disable request retrying for wasm for now
Backoff supports the retry method for futures only for non-wasm targets for now, thus we're going to disable it until that changes.master
parent
ca7117af2b
commit
36e3039d73
|
@ -50,7 +50,7 @@ default_features = false
|
|||
version = "0.11.0"
|
||||
default_features = false
|
||||
|
||||
[dependencies.backoff]
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.backoff]
|
||||
git = "https://github.com/ihrwein/backoff"
|
||||
features = ["tokio"]
|
||||
rev = "fa3fb91431729ce871d29c62b93425b8aec740f4"
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
use std::{convert::TryFrom, fmt::Debug, sync::Arc};
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[cfg(all(not(test), not(target_arch = "wasm32")))]
|
||||
use backoff::{future::retry, Error as RetryError, ExponentialBackoff};
|
||||
#[cfg(not(test))]
|
||||
#[cfg(all(not(test), not(target_arch = "wasm32")))]
|
||||
use http::StatusCode;
|
||||
use http::{HeaderValue, Method as HttpMethod, Response as HttpResponse};
|
||||
use reqwest::{Client, Response};
|
||||
|
@ -30,7 +30,9 @@ use matrix_sdk_common::{
|
|||
|
||||
use crate::{error::HttpError, ClientConfig, OutgoingRequest, Session};
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const DEFAULT_CONNECTION_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const DEFAULT_REQUEST_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
/// Abstraction around the http layer. The allows implementors to use different
|
||||
|
@ -235,7 +237,7 @@ async fn response_to_http_response(
|
|||
.expect("Can't construct a response using the given body"))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(any(test, target_arch = "wasm32"))]
|
||||
async fn send_request(
|
||||
client: &Client,
|
||||
request: http::Request<Vec<u8>>,
|
||||
|
@ -247,7 +249,7 @@ async fn send_request(
|
|||
Ok(response_to_http_response(response).await?)
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[cfg(all(not(test), not(target_arch = "wasm32")))]
|
||||
async fn send_request(
|
||||
client: &Client,
|
||||
request: http::Request<Vec<u8>>,
|
||||
|
|
Loading…
Reference in New Issue