notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 40fd85da58170f43684cc949a1066eee80047b6c
parent 3870bc950698588c61d7eaea1c5e2fde4e9b2efc
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 16 Feb 2024 11:37:19 -0800

relay: don't query unknown authors if we have none to query

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Msrc/app.rs | 20+++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/app.rs b/src/app.rs @@ -375,15 +375,17 @@ fn handle_eose(damus: &mut Damus, subid: &str, relay_url: &str) -> Result<()> { let txn = Transaction::new(&damus.ndb)?; let authors = get_unknown_author_ids(&txn, damus, 0)?; let n_authors = authors.len(); - let filter = Filter::new() - .authors(authors.iter().map(|p| Pubkey::new(*p)).collect()) - .kinds(vec![0]); - info!( - "Getting {} unknown author profiles from {}", - n_authors, relay_url - ); - let msg = ClientMessage::req("profiles".to_string(), vec![filter]); - damus.pool.send_to(&msg, relay_url); + if n_authors > 0 { + let filter = Filter::new() + .authors(authors.iter().map(|p| Pubkey::new(*p)).collect()) + .kinds(vec![0]); + info!( + "Getting {} unknown author profiles from {}", + n_authors, relay_url + ); + let msg = ClientMessage::req("profiles".to_string(), vec![filter]); + damus.pool.send_to(&msg, relay_url); + } } else if subid == "profiles" { let msg = ClientMessage::close("profiles".to_string()); damus.pool.send_to(&msg, relay_url);