aboutsummaryrefslogtreecommitdiff
path: root/src/rpc_client.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-17 15:36:16 +0200
committerAlex Auvolat <alex@adnab.me>2020-04-17 15:40:13 +0200
commite41ce4d81528388f043c1c5e6608df45347ea70d (patch)
treeee25f06b6f7da356c53d5f0a8fc8ec9e81d4bb23 /src/rpc_client.rs
parent867646093b24a9bb7e4b24a7f2248615c6e03fde (diff)
downloadgarage-e41ce4d81528388f043c1c5e6608df45347ea70d.tar.gz
garage-e41ce4d81528388f043c1c5e6608df45347ea70d.zip
Implement getting missing blocks when RC increases
Issue: RC increases also when the block ref entry is first put by the actual client. At that point the client is probably already sending us the block content, so we don't need to do a get... We should add a delay before the task is added or find something to do.
Diffstat (limited to 'src/rpc_client.rs')
-rw-r--r--src/rpc_client.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rpc_client.rs b/src/rpc_client.rs
index 81d20966..f8da778c 100644
--- a/src/rpc_client.rs
+++ b/src/rpc_client.rs
@@ -1,7 +1,7 @@
+use std::borrow::Borrow;
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;
-use std::borrow::Borrow;
use bytes::IntoBuf;
use futures::stream::futures_unordered::FuturesUnordered;
@@ -45,7 +45,8 @@ pub async fn rpc_try_call_many(
) -> Result<Vec<Message>, Error> {
let sys2 = sys.clone();
let msg = Arc::new(msg);
- let mut resp_stream = to.to_vec()
+ let mut resp_stream = to
+ .to_vec()
.into_iter()
.map(move |to| rpc_call(sys2.clone(), to.clone(), msg.clone(), timeout))
.collect::<FuturesUnordered<_>>();
@@ -95,7 +96,12 @@ pub async fn rpc_call<M: Borrow<Message>, N: Borrow<UUID>>(
let status = sys.status.borrow().clone();
match status.nodes.get(to.borrow()) {
Some(status) => status.addr.clone(),
- None => return Err(Error::Message(format!("Peer ID not found: {:?}", to.borrow()))),
+ None => {
+ return Err(Error::Message(format!(
+ "Peer ID not found: {:?}",
+ to.borrow()
+ )))
+ }
}
};
sys.rpc_client.call(&addr, msg, timeout).await