aboutsummaryrefslogtreecommitdiff
path: root/src/rpc_server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-22 17:04:33 +0000
committerAlex Auvolat <alex@adnab.me>2020-04-22 17:04:33 +0000
commit8971f34c816c42a0eb2bbcead5ac7f05854ddfb6 (patch)
tree8f2b272e1d033cab12b17271d036e3d1c0a183ba /src/rpc_server.rs
parente8214cb1807d3145907c7ed9e077fa45ada4aeea (diff)
downloadgarage-8971f34c816c42a0eb2bbcead5ac7f05854ddfb6.tar.gz
garage-8971f34c816c42a0eb2bbcead5ac7f05854ddfb6.zip
Well they still have to exit when we're exiting though
Diffstat (limited to 'src/rpc_server.rs')
-rw-r--r--src/rpc_server.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/rpc_server.rs b/src/rpc_server.rs
index 51661a66..bcf7496f 100644
--- a/src/rpc_server.rs
+++ b/src/rpc_server.rs
@@ -47,16 +47,13 @@ where
let begin_time = Instant::now();
let whole_body = hyper::body::to_bytes(req.into_body()).await?;
let msg = rmp_serde::decode::from_read::<_, M>(whole_body.into_buf())?;
- let req_str = debug_serialize(&msg);
match handler(msg, sockaddr).await {
Ok(resp) => {
let resp_bytes = rmp_to_vec_all_named::<Result<M, String>>(&Ok(resp))?;
- trace!(
- "]RPC:{},ok ({} ms), request: {}",
- name,
- (Instant::now() - begin_time).as_millis(),
- req_str,
- );
+ let rpc_duration = (Instant::now() - begin_time).as_millis();
+ if rpc_duration > 100 {
+ debug!("RPC {} ok, took long: {} ms", name, rpc_duration,);
+ }
Ok(Response::new(Body::from(resp_bytes)))
}
Err(e) => {
@@ -65,11 +62,10 @@ where
let mut err_response = Response::new(Body::from(rep_bytes));
*err_response.status_mut() = e.http_status_code();
warn!(
- "RPC error ({}): {} ({} ms), request: {}",
+ "RPC error ({}): {} ({} ms)",
name,
e,
(Instant::now() - begin_time).as_millis(),
- req_str,
);
Ok(err_response)
}