forked from janek/mostr
1
0
Fork 0

fix(main): increase notification channel size

apparently it needs to be double of the expected events,
so even this is only a temporary remedy
This commit is contained in:
xeruf 2024-10-01 23:19:01 +02:00
parent a297f61363
commit c6de8daee9
1 changed files with 19 additions and 1 deletions

View File

@ -203,7 +203,9 @@ async fn main() -> Result<()> {
};
let client = ClientBuilder::new()
.opts(Options::new().automatic_authentication(true))
.opts(Options::new()
.automatic_authentication(true)
.pool(RelayPoolOptions::new().notification_channel_size(8192)))
.signer(&keys)
.build();
info!("My public key: {}", keys.public_key());
@ -246,6 +248,22 @@ async fn main() -> Result<()> {
let sub2 = client.subscribe(vec![Filter::new().kinds(PROP_KINDS)], None).await;
info!("Subscribed to updates with {:?}", sub2);
if args.peek().is_some_and(|arg| arg == "--watch-events") {
loop {
match notifications.recv().await {
Ok(notification) => {
if let RelayPoolNotification::Event { event, .. } = notification {
println!("At {} found {} kind {} content \"{}\"", event.created_at, event.id, event.kind, event.content);
}
}
Err(e) => {
println!("Aborting due to {:?}", e);
return Ok(());
}
}
}
}
let metadata = var("USER").ok().map(
|user| Metadata::new().name(user));
let moved_metadata = metadata.clone();