aboutsummaryrefslogtreecommitdiff
path: root/src/rpc_server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-21 14:07:15 +0000
committerAlex Auvolat <alex@adnab.me>2020-04-21 14:08:28 +0000
commitbe0a2bae8112de1d4674767c5c60e296c28e8532 (patch)
tree84211f371693c9085caf6bf27c6bae715dbdd599 /src/rpc_server.rs
parentcc4f2f1cfb30e3995edf3c1174bd06b4bc0a9bf1 (diff)
downloadgarage-be0a2bae8112de1d4674767c5c60e296c28e8532.tar.gz
garage-be0a2bae8112de1d4674767c5c60e296c28e8532.zip
Add node tags in configuration
Diffstat (limited to 'src/rpc_server.rs')
-rw-r--r--src/rpc_server.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/rpc_server.rs b/src/rpc_server.rs
index 4541e4da..938eb512 100644
--- a/src/rpc_server.rs
+++ b/src/rpc_server.rs
@@ -1,8 +1,8 @@
use std::collections::HashMap;
use std::net::SocketAddr;
use std::pin::Pin;
-use std::time::Instant;
use std::sync::Arc;
+use std::time::Instant;
use bytes::IntoBuf;
use futures::future::Future;
@@ -51,7 +51,11 @@ where
match handler(msg, sockaddr).await {
Ok(resp) => {
let resp_bytes = rmp_to_vec_all_named::<Result<M, String>>(&Ok(resp))?;
- trace!("]RPC:{},ok ({} ms)", name, (Instant::now()-begin_time).as_millis());
+ trace!(
+ "]RPC:{},ok ({} ms)",
+ name,
+ (Instant::now() - begin_time).as_millis()
+ );
Ok(Response::new(Body::from(resp_bytes)))
}
Err(e) => {
@@ -59,7 +63,13 @@ where
let rep_bytes = rmp_to_vec_all_named::<Result<M, String>>(&Err(err_str))?;
let mut err_response = Response::new(Body::from(rep_bytes));
*err_response.status_mut() = e.http_status_code();
- warn!("RPC error ({}): {} ({} ms), request: {}", name, e, (Instant::now()-begin_time).as_millis(), req_str);
+ warn!(
+ "RPC error ({}): {} ({} ms), request: {}",
+ name,
+ e,
+ (Instant::now() - begin_time).as_millis(),
+ req_str
+ );
Ok(err_response)
}
}