From 16fbb32fd3ac00f76937c2799d01e7607449fa94 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 1 May 2020 19:18:54 +0000 Subject: Rate limit requests a bit more seriously droping the slot later (after reading the request response) means that we aren't freeing our quota slot, so the maximum number of simultaneous requests now also counts the response reading phase TODO next: quotas per rpc destination node, or maybe per datacenter (?) --- src/rpc/rpc_client.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/rpc') diff --git a/src/rpc/rpc_client.rs b/src/rpc/rpc_client.rs index 3f943dcc..6119696d 100644 --- a/src/rpc/rpc_client.rs +++ b/src/rpc/rpc_client.rs @@ -328,10 +328,11 @@ impl RpcHttpClient { ); e })?; - drop(slot); let status = resp.status(); let body = hyper::body::to_bytes(resp.into_body()).await?; + drop(slot); + match rmp_serde::decode::from_read::<_, Result>(body.into_buf())? { Err(e) => Ok(Err(Error::RemoteError(e, status))), Ok(x) => Ok(Ok(x)), -- cgit v1.2.3