Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: fix check for synced replicas
Fintan Halpenny committed 2 years ago
commit b6d8bc94897cd547bf564f574349d22659ad28f6
parent 16478e721bd506b6c49a8ec69f5d55036c3f29f3
1 file changed +9 -3
modified radicle-cli/src/commands/sync.rs
@@ -398,15 +398,21 @@ fn announce_refs(
                }
            }
            RepoSync::Replicas(replicas) => {
-
                let synced = synced.collect::<Vec<_>>();
-
                if synced.len() >= seeds.len() {
+
                let synced = synced
+
                    .filter(|s| &s.nid != profile.id())
+
                    .collect::<Vec<_>>();
+
                let connected = seeds
+
                    .connected()
+
                    .filter(|s| &s.nid != profile.id())
+
                    .collect::<Vec<_>>();
+
                if synced.len() >= connected.len() {
                    term::success!(
                        "Nothing to announce, already in sync with network (see `rad sync status`)"
                    );
                    return Ok(());
                }
                // Replicas not counting our local replica.
-
                let remotes = synced.iter().filter(|s| &s.nid != profile.id()).count();
+
                let remotes = synced.len();
                if remotes >= replicas {
                    term::success!("Nothing to announce, already in sync with {remotes} seed(s) (see `rad sync status`)");
                    return Ok(());