From 29a093993ce7d0210ac39ceb1a25acc9350492e7 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 19 Jul 2024 22:10:23 +0100 Subject: feat: save created events to cache as soon as they are successfully sent to at least one relay --- src/sub_commands/send.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/sub_commands/send.rs') diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index f94eed3..95d3eb0 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs @@ -239,6 +239,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re send_events( &client, + git_repo_path, events.clone(), user_ref.relays.write(), repo_ref.relays.clone(), @@ -279,6 +280,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re pub async fn send_events( #[cfg(test)] client: &crate::client::MockConnect, #[cfg(not(test))] client: &Client, + git_repo_path: &Path, events: Vec, my_write_relays: Vec, repo_read_relays: Vec, @@ -392,7 +394,10 @@ pub async fn send_events( pb.inc(0); // need to make pb display intially let mut failed = false; for event in &events { - match client.send_event_to(relay.as_str(), event.clone()).await { + match client + .send_event_to(git_repo_path, relay.as_str(), event.clone()) + .await + { Ok(_) => pb.inc(1), Err(e) => { pb.set_style(pb_after_style_failed.clone()); -- cgit v1.2.3