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 (?)
This commit is contained in:
Alex Auvolat 2020-05-01 19:18:54 +00:00
parent d867bbcfb5
commit 16fbb32fd3

View file

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