Skip to content

Commit e3d4cb1

Browse files
committed
Building the continuum vector doesn't return errors
1 parent 08939fb commit e3d4cb1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ring.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ impl Default for NodesResult {
3939

4040
impl Extend<Result<Node, Error>> for NodesResult {
4141
fn extend<T: IntoIterator<Item = Result<Node, Error>>>(&mut self, iter: T) {
42+
if self.0.is_err() {
43+
return;
44+
}
45+
4246
for item in iter {
4347
match item {
4448
Ok(node) => self.0.as_mut().unwrap().push(node),
@@ -62,7 +66,7 @@ impl Ring {
6266
Err(e) => return Err(e),
6367
};
6468

65-
let continuum = build_continuum(&servers).await?;
69+
let continuum = build_continuum(&servers).await;
6670

6771
Ok(Ring { servers, continuum })
6872
}
@@ -102,7 +106,7 @@ fn hash_for<K: AsRef<[u8]>>(key: K) -> u32 {
102106
crc32fast::hash(key.as_ref())
103107
}
104108

105-
async fn build_continuum(servers: &[Node]) -> Result<Vec<Entry>, Error> {
109+
async fn build_continuum(servers: &[Node]) -> Vec<Entry> {
106110
let mut continuum = Vec::new();
107111

108112
for (i, server) in servers.iter().enumerate() {
@@ -119,5 +123,5 @@ async fn build_continuum(servers: &[Node]) -> Result<Vec<Entry>, Error> {
119123
}
120124
}
121125

122-
Ok(continuum)
126+
continuum
123127
}

0 commit comments

Comments
 (0)