forked from Deuxfleurs/garage
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:
parent
d867bbcfb5
commit
16fbb32fd3
1 changed files with 2 additions and 1 deletions
|
@ -328,10 +328,11 @@ impl RpcHttpClient {
|
||||||
);
|
);
|
||||||
e
|
e
|
||||||
})?;
|
})?;
|
||||||
drop(slot);
|
|
||||||
|
|
||||||
let status = resp.status();
|
let status = resp.status();
|
||||||
let body = hyper::body::to_bytes(resp.into_body()).await?;
|
let body = hyper::body::to_bytes(resp.into_body()).await?;
|
||||||
|
drop(slot);
|
||||||
|
|
||||||
match rmp_serde::decode::from_read::<_, Result<M, String>>(body.into_buf())? {
|
match rmp_serde::decode::from_read::<_, Result<M, String>>(body.into_buf())? {
|
||||||
Err(e) => Ok(Err(Error::RemoteError(e, status))),
|
Err(e) => Ok(Err(Error::RemoteError(e, status))),
|
||||||
Ok(x) => Ok(Ok(x)),
|
Ok(x) => Ok(Ok(x)),
|
||||||
|
|
Loading…
Reference in a new issue