From 45dc04b81bf7c07f249c9539a48516d4c17abdba Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 31 Jan 2024 00:00:00 +0000 Subject: fix: intermittent crashing by removing block_on a crashing bug was identifed when users ran ngit with large relay sets. the test suite would also stop at random tests and produce a ...running for over 60 seconds error but only on nix configuration and not when using rustup. this change fixes this so the ngit must have been crashing more often when ran with the reduced resources of a nix shell. the test suite consistantly runs successfully under nix when this change is applied to v0.1.0. later changes were made to mitigate this and other issues as hot fixes which either intentionally broke tests (to rush the change through as a hotfix) or unintentionally in the case of nostr 0.27 upgrade in fc3f22eac2bb81823f170f61ba9d39baff76b933 changes introduced in e0f543e8adb144f6deff6ff7ea0c412c9fcac5b4, specifically queuing up relays, are probably not needed so I have increased the number of relays proccessed at any one time from 5 to 15 --- src/client.rs | 2 +- src/main.rs | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/client.rs b/src/client.rs index 968e55f..7530880 100644 --- a/src/client.rs +++ b/src/client.rs @@ -150,7 +150,7 @@ impl Connect for Client { }) .collect(); - let relay_results = stream::iter(futures).buffer_unordered(5).collect().await; + let relay_results = stream::iter(futures).buffer_unordered(15).collect().await; Ok(get_dedup_events(relay_results)) } diff --git a/src/main.rs b/src/main.rs index 996b697..85b2812 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,14 +48,10 @@ enum Commands { async fn main() -> Result<()> { let cli = Cli::parse(); match &cli.command { - Commands::Login(args) => { - futures::executor::block_on(sub_commands::login::launch(&cli, args)) - } - Commands::Claim(args) => { - futures::executor::block_on(sub_commands::claim::launch(&cli, args)) - } - Commands::Prs(args) => futures::executor::block_on(sub_commands::prs::launch(&cli, args)), - Commands::Pull => futures::executor::block_on(sub_commands::pull::launch()), - Commands::Push => futures::executor::block_on(sub_commands::push::launch(&cli)), + Commands::Login(args) => sub_commands::login::launch(&cli, args).await, + Commands::Claim(args) => sub_commands::claim::launch(&cli, args).await, + Commands::Prs(args) => sub_commands::prs::launch(&cli, args).await, + Commands::Pull => sub_commands::pull::launch().await, + Commands::Push => sub_commands::push::launch(&cli).await, } } -- cgit v1.2.3