From d7cba73ead03d1eab272bff90b6e056a5abf9933 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 9 May 2022 16:19:00 -0700 Subject: [PATCH] Decrement pending_contact_requests even if a request fails --- crates/client/src/user.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs index 6fd9b1ded1625d889b5d30be46874c31cbe75d06..b4743d35675a8fce9c5efa0ac6d263afca687694 100644 --- a/crates/client/src/user.rs +++ b/crates/client/src/user.rs @@ -322,10 +322,10 @@ impl UserStore { cx.notify(); cx.spawn(|this, mut cx| async move { - let request = client + let response = client .ok_or_else(|| anyhow!("can't upgrade client reference"))? - .request(request); - request.await?; + .request(request) + .await; this.update(&mut cx, |this, cx| { if let Entry::Occupied(mut request_count) = this.pending_contact_requests.entry(user_id) @@ -337,6 +337,7 @@ impl UserStore { } cx.notify(); }); + response?; Ok(()) }) }