diff --git a/Cargo.lock b/Cargo.lock index 6b76953e3..77b660188 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,7 +12,7 @@ dependencies = [ "futures-sink", "log", "pin-project 0.4.27", - "tokio 0.2.24", + "tokio", "tokio-util", ] @@ -135,7 +135,7 @@ dependencies = [ "futures-channel", "futures-util", "smallvec", - "tokio 0.2.24", + "tokio", ] [[package]] @@ -1171,7 +1171,7 @@ dependencies = [ "http", "indexmap", "slab", - "tokio 0.2.24", + "tokio", "tokio-util", "tracing", "tracing-futures", @@ -1326,7 +1326,7 @@ dependencies = [ "itoa", "pin-project 1.0.2", "socket2", - "tokio 0.2.24", + "tokio", "tower-service", "tracing", "want", @@ -1343,7 +1343,7 @@ dependencies = [ "hyper", "log", "rustls 0.18.1", - "tokio 0.2.24", + "tokio", "tokio-rustls", "webpki", ] @@ -1671,7 +1671,7 @@ dependencies = [ "once_cell", "rand 0.8.1", "regex", - "rustls 0.19.0", + "rustls 0.18.1", "sentry", "serde", "serde_json", @@ -1684,7 +1684,7 @@ dependencies = [ "tar", "tempdir", "tempfile", - "tokio 1.0.1", + "tokio", "ureq", "vergen", "walkdir", @@ -2348,7 +2348,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "tokio 0.2.24", + "tokio", "tokio-rustls", "url", "wasm-bindgen", @@ -3019,25 +3019,15 @@ dependencies = [ "pin-project-lite 0.1.11", "signal-hook-registry", "slab", + "tokio-macros", "winapi 0.3.9", ] -[[package]] -name = "tokio" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d258221f566b6c803c7b4714abadc080172b272090cdc5e244a6d4dd13c3a6bd" -dependencies = [ - "autocfg", - "pin-project-lite 0.2.0", - "tokio-macros", -] - [[package]] name = "tokio-macros" -version = "1.0.0" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42517d2975ca3114b22a16192634e8241dc5cc1f130be194645970cc1c371494" +checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" dependencies = [ "proc-macro2", "quote", @@ -3052,7 +3042,7 @@ checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a" dependencies = [ "futures-core", "rustls 0.18.1", - "tokio 0.2.24", + "tokio", "webpki", ] @@ -3067,7 +3057,7 @@ dependencies = [ "futures-sink", "log", "pin-project-lite 0.1.11", - "tokio 0.2.24", + "tokio", ] [[package]] @@ -3123,7 +3113,7 @@ dependencies = [ "rand 0.7.3", "smallvec", "thiserror", - "tokio 0.2.24", + "tokio", "url", ] @@ -3143,7 +3133,7 @@ dependencies = [ "resolv-conf", "smallvec", "thiserror", - "tokio 0.2.24", + "tokio", "trust-dns-proto", ] diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index b85889ed1..30dc4f7d9 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -40,7 +40,7 @@ mime = "0.3.16" once_cell = "1.5.2" rand = "0.8.1" regex = "1.4.2" -rustls = "0.19.0" +rustls = "0.18.0" serde = { version = "1.0.118", features = ["derive"] } serde_json = { version = "1.0.61", features = ["preserve_order"] } serde_qs = "0.8.2" @@ -50,7 +50,7 @@ slice-group-by = "0.2.6" structopt = "0.3.21" tar = "0.4.30" tempfile = "3.1.0" -tokio = { version = "1.0.1", features = ["macros"] } +tokio = { version = "0.2", features = ["macros"] } ureq = { version = "2.0.0", features = ["tls"], default-features = false } walkdir = "2.3.1" whoami = "1.0.3" @@ -73,7 +73,7 @@ optional = true [dev-dependencies] serde_url_params = "0.2.0" tempdir = "0.3.7" -tokio = { version = "1.0.1", features = ["macros", "time"] } +tokio = { version = "0.2", features = ["macros", "time"] } [dev-dependencies.assert-json-diff] git = "https://github.com/qdequele/assert-json-diff" diff --git a/meilisearch-http/src/analytics.rs b/meilisearch-http/src/analytics.rs index 379a25030..c9106496b 100644 --- a/meilisearch-http/src/analytics.rs +++ b/meilisearch-http/src/analytics.rs @@ -127,9 +127,14 @@ pub fn analytics_sender(data: Data, opt: Opt) { let body = qs::to_string(&request).unwrap(); let response = ureq::post("https://api.amplitude.com/httpapi").send_string(&body); - if !response.ok() { - let body = response.into_string().unwrap(); - error!("Unsuccessful call to Amplitude: {}", body); + match response { + Err(ureq::Error::Status(_ , response)) => { + error!("Unsuccessful call to Amplitude: {}", response.into_string().unwrap_or_default()); + } + Err(e) => { + error!("Unsuccessful call to Amplitude: {}", e); + } + _ => (), } thread::sleep(Duration::from_secs(3600)) // one hour