ignore warnings for truncation

This commit is contained in:
MatthieuCoder 2023-01-25 08:52:44 +04:00
parent 2647bd0356
commit ebbb387700
2 changed files with 18 additions and 27 deletions

View file

@ -239,17 +239,16 @@ pub async fn handle_request(
match ratelimiter match ratelimiter
.ticket(bucket.clone()) .ticket(bucket.clone())
.instrument(debug_span!("ticket validation request")) .instrument(debug_span!("ticket validation request"))
.then(|v| async { .await
{
Ok(_) => {
#[allow(clippy::cast_possible_truncation)]
TICKET_TIMES.record( TICKET_TIMES.record(
&cx, &cx,
ticket_start.elapsed()?.as_millis() as u64, ticket_start.elapsed()?.as_millis() as u64,
&[KeyValue::new("bucket", name)], &[KeyValue::new("bucket", name)],
); );
v }
})
.await
{
Ok(_) => {}
Err(e) => { Err(e) => {
error!("Error when requesting the ratelimiter: {:?}", e); error!("Error when requesting the ratelimiter: {:?}", e);
bail!("failed to request the ratelimiter"); bail!("failed to request the ratelimiter");
@ -294,20 +293,16 @@ pub async fn handle_request(
let span = debug_span!("upstream request to discord"); let span = debug_span!("upstream request to discord");
let upstream_start = SystemTime::now(); let upstream_start = SystemTime::now();
UPSTREAM_CALLS.add(&cx, 1, &[KeyValue::new("bucket", name)]); UPSTREAM_CALLS.add(&cx, 1, &[KeyValue::new("bucket", name)]);
let resp = match client let resp = match client.request(request).instrument(span).await {
.request(request) Ok(response) => {
.instrument(span) #[allow(clippy::cast_possible_truncation)]
.then(|v| async {
UPSTREAM_TIMES.record( UPSTREAM_TIMES.record(
&cx, &cx,
upstream_start.elapsed()?.as_millis() as u64, upstream_start.elapsed()?.as_millis() as u64,
&[KeyValue::new("bucket", name)], &[KeyValue::new("bucket", name)],
); );
v.context("") response
}) }
.await
{
Ok(response) => response,
Err(e) => { Err(e) => {
error!("Error when requesting the Discord API: {:?}", e); error!("Error when requesting the Discord API: {:?}", e);
bail!("failed to request the discord api"); bail!("failed to request the discord api");
@ -329,18 +324,16 @@ pub async fn handle_request(
let headers_start = SystemTime::now(); let headers_start = SystemTime::now();
HEADERS_SUBMIT_CALLS.add(&cx, 1, &[KeyValue::new("bucket", name)]); HEADERS_SUBMIT_CALLS.add(&cx, 1, &[KeyValue::new("bucket", name)]);
let _submit_headers = ratelimiter ratelimiter
.submit_headers(bucket.clone(), headers) .submit_headers(bucket.clone(), headers)
.instrument(info_span!("submitting headers")) .instrument(info_span!("submitting headers"))
.then(|v| async { .await?;
HEADERS_SUBMIT_TIMES.record( #[allow(clippy::cast_possible_truncation)]
&cx, HEADERS_SUBMIT_TIMES.record(
headers_start.elapsed()?.as_millis() as u64, &cx,
&[KeyValue::new("bucket", name)], headers_start.elapsed()?.as_millis() as u64,
); &[KeyValue::new("bucket", name)],
v );
})
.await;
Ok(resp) Ok(resp)
} }

View file

@ -1,2 +0,0 @@
max_payload: 100000000
max_pending: 1000000000