aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-05-01 19:18:54 +0000
committerAlex Auvolat <alex@adnab.me>2020-05-01 19:18:54 +0000
commit16fbb32fd3ac00f76937c2799d01e7607449fa94 (patch)
tree73bae27a7ca89caf3ca19ff7ffa668fd2f27efd6
parentd867bbcfb513761c6709347509b8438cfdf408c7 (diff)
downloadgarage-16fbb32fd3ac00f76937c2799d01e7607449fa94.tar.gz
garage-16fbb32fd3ac00f76937c2799d01e7607449fa94.zip
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 (?)
-rw-r--r--src/rpc/rpc_client.rs3
1 files changed, 2 insertions, 1 deletions
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<M, String>>(body.into_buf())? {
Err(e) => Ok(Err(Error::RemoteError(e, status))),
Ok(x) => Ok(Ok(x)),