From 38626520c19d5d1089636874dce1568de193163a Mon Sep 17 00:00:00 2001 From: William Casarin Date: Wed, 31 Jul 2024 13:27:41 -0700 Subject: [PATCH] thread: warn when we return 0 notes This is a bug Signed-off-by: William Casarin --- src/thread.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/thread.rs b/src/thread.rs index a43180f..5a065e4 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -4,7 +4,7 @@ use crate::Error; use nostrdb::{Filter, FilterBuilder, Ndb, Subscription, Transaction}; use std::cmp::Ordering; use std::collections::HashMap; -use tracing::debug; +use tracing::{debug, warn}; #[derive(Default)] pub struct Thread { @@ -173,7 +173,12 @@ impl Threads { vec![] }; - debug!("found thread with {} notes", notes.len()); + if notes.is_empty() { + warn!("thread query returned 0 notes? ") + } else { + debug!("found thread with {} notes", notes.len()); + } + self.root_id_to_thread .insert(root_id.to_owned(), Thread::new(notes)); ThreadResult::Fresh(self.root_id_to_thread.get_mut(root_id).unwrap())