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

@ -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