From c6de8daee9697ee58528aba97bfca16257aa0d1f Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 1 Oct 2024 23:19:01 +0200 Subject: [PATCH] fix(main): increase notification channel size apparently it needs to be double of the expected events, so even this is only a temporary remedy --- src/main.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 4bf8c90..bcb1f7f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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();