SIGN IN SIGN UP

fix: offload async request body compression to a worker thread (#950)

The async `ImpitHttpClientAsync.call()` serialized and compressed
request bodies inline on the event loop. Compression is CPU-bound (and
brotli is becoming the default via the Apify SDK), so it blocked the
loop for the whole duration of the compression, stalling every other
concurrent task (response reads, the platform events websocket, other
in-flight requests).

Request preparation is now offloaded to a worker thread via
`asyncio.to_thread` whenever there is a body to compress. Bodyless
requests (the common polling, listing, and get path) stay inline to
avoid a needless thread-dispatch hop. The synchronous client is
unchanged, as it has no event loop to block.
V
Vlada Dusek committed
7ac3885826f0010df63eee9f1d30b5aed825872e
Parent: b302e23
Committed by GitHub <noreply@github.com> on 7/17/2026, 9:14:24 AM