Decrement pending_contact_requests even if a request fails

This commit is contained in:
Max Brunsfeld 2022-05-09 16:19:00 -07:00
parent 2aec4ff234
commit d7cba73ead

View file

@ -322,10 +322,10 @@ impl UserStore {
cx.notify(); cx.notify();
cx.spawn(|this, mut cx| async move { cx.spawn(|this, mut cx| async move {
let request = client let response = client
.ok_or_else(|| anyhow!("can't upgrade client reference"))? .ok_or_else(|| anyhow!("can't upgrade client reference"))?
.request(request); .request(request)
request.await?; .await;
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
if let Entry::Occupied(mut request_count) = if let Entry::Occupied(mut request_count) =
this.pending_contact_requests.entry(user_id) this.pending_contact_requests.entry(user_id)
@ -337,6 +337,7 @@ impl UserStore {
} }
cx.notify(); cx.notify();
}); });
response?;
Ok(()) Ok(())
}) })
} }