cli: Make sure we sync inventory before announcing
This commit is contained in:
parent
112c940d81
commit
1ab1da1ba1
|
|
@ -80,7 +80,6 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let mut doc = doc.verified()?;
|
let mut doc = doc.verified()?;
|
||||||
|
|
||||||
if doc.visibility.is_public() {
|
if doc.visibility.is_public() {
|
||||||
// TODO: We need to sync inventory too if it's not in the routing table.
|
|
||||||
return Err(Error::WithHint {
|
return Err(Error::WithHint {
|
||||||
err: anyhow!("repository is already public"),
|
err: anyhow!("repository is already public"),
|
||||||
hint: "to announce the repository to the network, run `rad sync --inventory`",
|
hint: "to announce the repository to the network, run `rad sync --inventory`",
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,7 @@ pub fn announce_inventory(mut node: Node) -> anyhow::Result<()> {
|
||||||
let peers = node.sessions()?.iter().filter(|s| s.is_connected()).count();
|
let peers = node.sessions()?.iter().filter(|s| s.is_connected()).count();
|
||||||
let spinner = term::spinner(format!("Announcing inventory to {peers} peers.."));
|
let spinner = term::spinner(format!("Announcing inventory to {peers} peers.."));
|
||||||
|
|
||||||
|
node.sync_inventory()?;
|
||||||
node.announce_inventory()?;
|
node.announce_inventory()?;
|
||||||
spinner.finish();
|
spinner.finish();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue