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

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-02-16 11:37:19 -08:00
parent 3870bc9506
commit 40fd85da58

View File

@@ -375,6 +375,7 @@ fn handle_eose(damus: &mut Damus, subid: &str, relay_url: &str) -> Result<()> {
let txn = Transaction::new(&damus.ndb)?; let txn = Transaction::new(&damus.ndb)?;
let authors = get_unknown_author_ids(&txn, damus, 0)?; let authors = get_unknown_author_ids(&txn, damus, 0)?;
let n_authors = authors.len(); let n_authors = authors.len();
if n_authors > 0 {
let filter = Filter::new() let filter = Filter::new()
.authors(authors.iter().map(|p| Pubkey::new(*p)).collect()) .authors(authors.iter().map(|p| Pubkey::new(*p)).collect())
.kinds(vec![0]); .kinds(vec![0]);
@@ -384,6 +385,7 @@ fn handle_eose(damus: &mut Damus, subid: &str, relay_url: &str) -> Result<()> {
); );
let msg = ClientMessage::req("profiles".to_string(), vec![filter]); let msg = ClientMessage::req("profiles".to_string(), vec![filter]);
damus.pool.send_to(&msg, relay_url); damus.pool.send_to(&msg, relay_url);
}
} else if subid == "profiles" { } else if subid == "profiles" {
let msg = ClientMessage::close("profiles".to_string()); let msg = ClientMessage::close("profiles".to_string());
damus.pool.send_to(&msg, relay_url); damus.pool.send_to(&msg, relay_url);