Better concurrency:

Use Notify instead of stupid sleep in background worker
Use Semaphore to limit concurrent requests in rpc_client
Make more background tasks cancellable
This commit is contained in:
Alex Auvolat
2020-04-22 16:51:52 +00:00
parent c0335ac690
commit e8214cb180
10 changed files with 153 additions and 120 deletions
+4 -3
View File
@@ -52,9 +52,10 @@ where
Ok(resp) => {
let resp_bytes = rmp_to_vec_all_named::<Result<M, String>>(&Ok(resp))?;
trace!(
"]RPC:{},ok ({} ms)",
"]RPC:{},ok ({} ms), request: {}",
name,
(Instant::now() - begin_time).as_millis()
(Instant::now() - begin_time).as_millis(),
req_str,
);
Ok(Response::new(Body::from(resp_bytes)))
}
@@ -68,7 +69,7 @@ where
name,
e,
(Instant::now() - begin_time).as_millis(),
req_str
req_str,
);
Ok(err_response)
}