aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/system.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-14 16:08:05 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-14 16:08:05 +0100
commit510b62010871e9133a98f625b85f07a7e50f6f23 (patch)
tree76aa4190c45571a1feeb92211a591501f116c63f /src/rpc/system.rs
parentdfc131850a09e7ceacfa98315adbef156e07e9ca (diff)
downloadgarage-510b62010871e9133a98f625b85f07a7e50f6f23.tar.gz
garage-510b62010871e9133a98f625b85f07a7e50f6f23.zip
Get rid of background::spawn
Diffstat (limited to 'src/rpc/system.rs')
-rw-r--r--src/rpc/system.rs29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/rpc/system.rs b/src/rpc/system.rs
index 3b321a7d..f03df509 100644
--- a/src/rpc/system.rs
+++ b/src/rpc/system.rs
@@ -21,7 +21,6 @@ use netapp::peering::fullmesh::FullMeshPeeringStrategy;
use netapp::util::parse_and_resolve_peer_addr_async;
use netapp::{NetApp, NetworkKey, NodeID, NodeKey};
-use garage_util::background::{self};
use garage_util::config::Config;
#[cfg(feature = "kubernetes-discovery")]
use garage_util::config::KubernetesDiscoveryConfig;
@@ -622,11 +621,7 @@ impl System {
if info.cluster_layout_version > local_info.cluster_layout_version
|| info.cluster_layout_staging_hash != local_info.cluster_layout_staging_hash
{
- let self2 = self.clone();
- background::spawn(async move {
- self2.pull_cluster_layout(from).await;
- Ok(())
- });
+ tokio::spawn(self.clone().pull_cluster_layout(from));
}
self.node_status
@@ -668,16 +663,18 @@ impl System {
drop(update_ring);
let self2 = self.clone();
- background::spawn(async move {
- self2
+ tokio::spawn(async move {
+ if let Err(e) = self2
.rpc
.broadcast(
&self2.system_endpoint,
SystemRpc::AdvertiseClusterLayout(layout),
RequestStrategy::with_priority(PRIO_HIGH),
)
- .await?;
- Ok(())
+ .await
+ {
+ warn!("Error while broadcasting new cluster layout: {}", e);
+ }
});
self.save_cluster_layout().await?;
@@ -766,12 +763,12 @@ impl System {
}
for (node_id, node_addr) in ping_list {
- background::spawn(
- self.netapp
- .clone()
- .try_connect(node_addr, node_id)
- .map(move |r| r.err_context(connect_error_message(node_addr, node_id))),
- );
+ let self2 = self.clone();
+ tokio::spawn(async move {
+ if let Err(e) = self2.netapp.clone().try_connect(node_addr, node_id).await {
+ error!("{}\n{}", connect_error_message(node_addr, node_id), e);
+ }
+ });
}
}