# cloud_api_client: Move spawn native websocket to the background \(\#62874\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/0f84a49e5193a9e87d272008c4ed7d02ce44dba7)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 0f84a49e5193a9e87d272008c4ed7d02ce44dba7

Requested commit: 0f84a49e5193a9e87d272008c4ed7d02ce44dba7

Commit: 0f84a49e5193a9e87d272008c4ed7d02ce44dba7

Tree: 589e4a23810ad8fe3a23af220ff06e35836cd5f4

Author: Remco Smits

Committer: GitHub

## Message

````
cloud_api_client: Move spawn native websocket to the background (#62874)

# Objective

While working on something else, I noticed that I sometimes get this
warning about a foreground hang:

```
2026-08-19T11:25:45+02:00 INFO [zed::reliability::hang_detection::logging] New foreground hang detected: Tasks(s) that ran too long 215.24375ms          - crates/cloud_api_client/src/websocket/native.rs:34:23
```

That I believe can just be safely moved to the background, unless I'm
missing something here.

## Solution

Spawn the websocket task on the background instead of on the foreground,
so that we can't hang the foreground thread anymore for **~200ms**.

## Testing

I have tested that I can still connect to the websocket, not sure what
else to test.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- N/A

---------

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
````

## Parents

- [9bb4787949ee555142487f75f73c73379e520d1b](https://git.cafe/gitcafe/zed/commit/9bb4787949ee555142487f75f73c73379e520d1b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/0f84a49e5193a9e87d272008c4ed7d02ce44dba7?format=markdown)
