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:
20
src/app.rs
20
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 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();
|
||||||
let filter = Filter::new()
|
if n_authors > 0 {
|
||||||
.authors(authors.iter().map(|p| Pubkey::new(*p)).collect())
|
let filter = Filter::new()
|
||||||
.kinds(vec![0]);
|
.authors(authors.iter().map(|p| Pubkey::new(*p)).collect())
|
||||||
info!(
|
.kinds(vec![0]);
|
||||||
"Getting {} unknown author profiles from {}",
|
info!(
|
||||||
n_authors, relay_url
|
"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);
|
let msg = ClientMessage::req("profiles".to_string(), vec![filter]);
|
||||||
|
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user