diff options
| author | MatthieuCoder <matthieu@matthieu-dev.xyz> | 2023-01-25 08:52:44 +0400 | 
|---|---|---|
| committer | MatthieuCoder <matthieu@matthieu-dev.xyz> | 2023-01-25 08:52:44 +0400 | 
| commit | ebbb387700c4617f5779885c2151aac71f4ca470 (patch) | |
| tree | 1330574b3f10a30656e6091c7cc4037ff93d0df0 | |
| parent | 2647bd0356e18dbb124f1883c99865616c42a89a (diff) | |
ignore warnings for truncation
| -rw-r--r-- | exes/rest/src/handler.rs | 43 | ||||
| -rw-r--r-- | nats.config | 2 | 
2 files changed, 18 insertions, 27 deletions
diff --git a/exes/rest/src/handler.rs b/exes/rest/src/handler.rs index 77dd0d3..1dbee58 100644 --- a/exes/rest/src/handler.rs +++ b/exes/rest/src/handler.rs @@ -239,17 +239,16 @@ pub async fn handle_request(      match ratelimiter          .ticket(bucket.clone())          .instrument(debug_span!("ticket validation request")) -        .then(|v| async { +        .await +    { +        Ok(_) => { +            #[allow(clippy::cast_possible_truncation)]              TICKET_TIMES.record(                  &cx,                  ticket_start.elapsed()?.as_millis() as u64,                  &[KeyValue::new("bucket", name)],              ); -            v -        }) -        .await -    { -        Ok(_) => {} +        }          Err(e) => {              error!("Error when requesting the ratelimiter: {:?}", e);              bail!("failed to request the ratelimiter"); @@ -294,20 +293,16 @@ pub async fn handle_request(      let span = debug_span!("upstream request to discord");      let upstream_start = SystemTime::now();      UPSTREAM_CALLS.add(&cx, 1, &[KeyValue::new("bucket", name)]); -    let resp = match client -        .request(request) -        .instrument(span) -        .then(|v| async { +    let resp = match client.request(request).instrument(span).await { +        Ok(response) => { +            #[allow(clippy::cast_possible_truncation)]              UPSTREAM_TIMES.record(                  &cx,                  upstream_start.elapsed()?.as_millis() as u64,                  &[KeyValue::new("bucket", name)],              ); -            v.context("") -        }) -        .await -    { -        Ok(response) => response, +            response +        }          Err(e) => {              error!("Error when requesting the Discord API: {:?}", e);              bail!("failed to request the discord api"); @@ -329,18 +324,16 @@ pub async fn handle_request(      let headers_start = SystemTime::now();      HEADERS_SUBMIT_CALLS.add(&cx, 1, &[KeyValue::new("bucket", name)]); -    let _submit_headers = ratelimiter +    ratelimiter          .submit_headers(bucket.clone(), headers)          .instrument(info_span!("submitting headers")) -        .then(|v| async { -            HEADERS_SUBMIT_TIMES.record( -                &cx, -                headers_start.elapsed()?.as_millis() as u64, -                &[KeyValue::new("bucket", name)], -            ); -            v -        }) -        .await; +        .await?; +    #[allow(clippy::cast_possible_truncation)] +    HEADERS_SUBMIT_TIMES.record( +        &cx, +        headers_start.elapsed()?.as_millis() as u64, +        &[KeyValue::new("bucket", name)], +    );      Ok(resp)  } diff --git a/nats.config b/nats.config deleted file mode 100644 index 9a228af..0000000 --- a/nats.config +++ /dev/null @@ -1,2 +0,0 @@ -max_payload: 100000000 -max_pending: 1000000000
\ No newline at end of file  | 
