Replace isahc by ureq

This commit is contained in:
Clément Renault 2019-11-28 16:41:42 +01:00
parent 6d686ac14f
commit 83ad80d9db
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
3 changed files with 182 additions and 148 deletions

View file

@ -19,7 +19,6 @@ env_logger = "0.7.1"
heed = "0.6.0"
http = "0.1.19"
indexmap = { version = "1.3.0", features = ["serde-1"] }
isahc = "0.7.6"
log = "0.4.8"
main_error = "0.1.0"
meilisearch-core = { path = "../meilisearch-core", version = "0.8.1" }
@ -33,6 +32,7 @@ serde_qs = "0.5.1"
siphasher = "0.3.1"
structopt = "0.3.3"
sysinfo = "0.9.5"
ureq = { version = "0.11.2", features = ["tls"], default-features = false }
walkdir = "2.2.9"
whoami = "0.6"

View file

@ -58,14 +58,10 @@ pub fn analytics_sender() {
};
let body = qs::to_string(&request).unwrap();
match isahc::post("https://api.amplitude.com/httpapi", body) {
Ok(response) => {
if !response.status().is_success() {
let body = response.into_body().text().unwrap();
error!("Unsuccessful call to Amplitude: {}", body);
}
}
Err(e) => error!("Error while sending a request to Amplitude: {}", e),
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);
}
thread::sleep(Duration::from_secs(86_400)) // one day