Skip to content

Commit

Permalink
thread: warn when we return 0 notes
Browse files Browse the repository at this point in the history
This is a bug

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Jul 31, 2024
1 parent 4b644be commit f67607c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -173,7 +173,12 @@ impl Threads {
vec![]
};

debug!("found thread with {} notes", notes.len());
if notes.len() == 0 {

Check failure on line 176 in src/thread.rs

View workflow job for this annotation

GitHub Actions / Clippy

length comparison to zero

Check failure on line 176 in src/thread.rs

View workflow job for this annotation

GitHub Actions / Clippy

length comparison to zero
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())
Expand Down

0 comments on commit f67607c

Please sign in to comment.