From 6a121b87eb1ec1c2873855c64e7355154fb0a21f Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 10 Oct 2024 09:34:03 +0000 Subject: [PATCH] fix: do not emit progress 1000 when configuration is cancelled There is already code below that emits progress 0 or 1000 depending on whether configuration succeeded or failed. Before this change cancelling resulted in progress 0 emitted, immediately followed by progress 1000. --- src/configure.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/configure.rs b/src/configure.rs index d836a11eb..a46338d9c 100644 --- a/src/configure.rs +++ b/src/configure.rs @@ -13,7 +13,7 @@ mod auto_mozilla; mod auto_outlook; pub(crate) mod server_params; -use anyhow::{bail, ensure, Context as _, Result}; +use anyhow::{bail, ensure, format_err, Context as _, Result}; use auto_mozilla::moz_autoconfigure; use auto_outlook::outlk_autodiscover; use deltachat_contact_tools::EmailAddress; @@ -80,10 +80,7 @@ impl Context { let res = self .inner_configure() - .race(cancel_channel.recv().map(|_| { - progress!(self, 0); - Ok(()) - })) + .race(cancel_channel.recv().map(|_| Err(format_err!("Cancelled")))) .await; self.free_ongoing().await;