fix: discover knots from repos.node_url instead of nodes.public_endpoint
Author: Aaron Steven White
Commit
f001483029645c47cbea54f1e0a25832068fed25Parent: b30532d50e
Structural diff unavailable
These commits were pushed via plain git push, so no pre-parsed
schemas are available. Install git-remote-cospan and re-push via panproto:// to
see scope-level changes, breaking change detection, and semantic diffs.
brew install panproto/tap/git-remote-cospan1 file changed +9 -7
@@ -34,14 +34,16 @@ pub async fn run(state: Arc<AppState>) {
3434 } 3535 3636 async fn discover_and_consume(state: &Arc<AppState>) -> anyhow::Result<()> { 37- let nodes = db::node::list(&state.db, 1000, None).await?; 38- let knot_urls: Vec<String> = nodes 37+ // Discover knot URLs from repos.node_url (more reliable than nodes.public_endpoint) 38+ let repos = db::repo::list_recent(&state.db, 5000, None).await?; 39+ let mut seen = std::collections::HashSet::new(); 40+ let knot_urls: Vec<String> = repos 3941 .iter() 40- .filter_map(|n| n.public_endpoint.as_ref()) 41- .filter(|url| !url.is_empty() && !url.contains("localhost") && !url.contains("192.168.")) 42- .map(|url| { 43- // Convert https://knot.example.com to wss://knot.example.com/events 44- let ws_url = url.replace("https://", "wss://").replace("http://", "ws://"); 42+ .filter(|r| !r.node_url.is_empty()) 43+ .filter(|r| !r.node_url.contains("localhost") && !r.node_url.contains("192.168.")) 44+ .filter(|r| seen.insert(r.node_url.clone())) 45+ .map(|r| { 46+ let ws_url = r.node_url.replace("https://", "wss://").replace("http://", "ws://"); 4547 format!("{ws_url}/events") 4648 }) 4749 .collect();