cli: Allow `init` without running node
This commit is contained in:
parent
e69be6051d
commit
c8c44c884c
|
|
@ -210,7 +210,7 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()>
|
|||
Ok((id, doc, _)) => {
|
||||
let proj = doc.project()?;
|
||||
|
||||
if options.track {
|
||||
if options.track && node.is_running() {
|
||||
// It's important to track our own repositories to make sure that our node signals
|
||||
// interest for them. This ensures that messages relating to them are relayed to us.
|
||||
node.track_repo(id)?;
|
||||
|
|
|
|||
|
|
@ -359,9 +359,18 @@ where
|
|||
for (id, addr) in addrs {
|
||||
self.connect(id, addr);
|
||||
}
|
||||
// Ensure that our inventory is recorded in our routing table.
|
||||
for id in self.storage.inventory()? {
|
||||
self.routing.insert(id, self.node_id(), time.as_millis())?;
|
||||
// Ensure that our inventory is recorded in our routing table, and we are tracking
|
||||
// all of it. It can happen that inventory is not properly tracked if for eg. the
|
||||
// user creates a new repository while the node is stopped.
|
||||
for rid in self.storage.inventory()? {
|
||||
self.routing.insert(rid, self.node_id(), time.as_millis())?;
|
||||
|
||||
if self
|
||||
.track_repo(&rid, tracking::Scope::All)
|
||||
.expect("Service::command: error tracking repository")
|
||||
{
|
||||
info!(target: "service", "Tracking local repository {rid}");
|
||||
}
|
||||
}
|
||||
// Setup subscription filter for tracked repos.
|
||||
self.filter = Filter::new(
|
||||
|
|
|
|||
Loading…
Reference in New Issue