From 18326cbbfde80bd72adaea48b39af4c1db1faabb Mon Sep 17 00:00:00 2001 From: enki Date: Sun, 17 May 2026 23:02:21 -0700 Subject: [PATCH] fix: track last_event per relay on the dashboard relay_url was being destructured as .. and thrown away, so update_relay_last_event was called with an empty string and matched no rows. Capture relay_url from the notification and pass it through so each relay row gets its last_event updated. --- src/nostr/reader.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nostr/reader.rs b/src/nostr/reader.rs index 14afa6a..158fd3d 100644 --- a/src/nostr/reader.rs +++ b/src/nostr/reader.rs @@ -101,9 +101,9 @@ async fn run_reader(cfg: Arc, pool: SqlitePool, connected: Arc { + RelayPoolNotification::Event { relay_url, event, .. } => { match event.kind.as_u16() { - 2003 => handle_torrent(&pool, &cfg, &enricher, blossom.as_deref(), &event).await, + 2003 => handle_torrent(&pool, &cfg, &enricher, blossom.as_deref(), relay_url.as_str(), &event).await, 30004 => handle_curation_set(&pool, &event).await, 1984 => handle_report(&pool, &cfg, &event).await, _ => {} @@ -128,7 +128,7 @@ async fn run_reader(cfg: Arc, pool: SqlitePool, connected: Arc, event: &nostr_sdk::Event) { +async fn handle_torrent(pool: &SqlitePool, cfg: &Config, enricher: &Enricher, blossom: Option<&BlossomClient>, relay_url: &str, event: &nostr_sdk::Event) { match super::parser::parse(event) { Ok(rec) => { // WoT / block / mute check @@ -166,7 +166,7 @@ async fn handle_torrent(pool: &SqlitePool, cfg: &Config, enricher: &Enricher, bl Err(e) => error!(event_id = %event.id, "db insert failed: {e}"), Ok(()) => { debug!(event_id = %event.id, title = %rec.title, "indexed torrent"); - let _ = db::update_relay_last_event(pool, "", event.created_at.as_secs() as i64).await; + let _ = db::update_relay_last_event(pool, relay_url, event.created_at.as_secs() as i64).await; if enricher.enabled() && rec.tmdb_id.is_empty() { let enricher = enricher.clone();