mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-29 20:11:13 +01:00
33156f0d81
`stream_in_background` forwards a model's events from a background task through a bounded `futures::channel::mpsc`. When the 32-event buffer fills, that channel parks the sender behind a `std` mutex that the receiver also locks to wake it. On the web the receiver polls on the browser's main thread, and the producer runs on a Web Worker. Waiting on a contended `std` mutex on the main thread traps with `Atomics.wait cannot be called in this context`, which can happen whenever rendering falls behind a model stream. `async_channel::bounded` keeps the same backpressure without that mutex. `gpui_web`'s HTTP response body already uses it for the same reason. Release Notes: - N/A