diff --git a/Project.toml b/Project.toml index 2cad120..4fda915 100644 --- a/Project.toml +++ b/Project.toml @@ -4,7 +4,7 @@ keywords = ["Swagger", "OpenAPI", "REST"] license = "MIT" desc = "OpenAPI server and client helper for Julia" authors = ["JuliaHub Inc."] -version = "0.2.5" +version = "0.2.6" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" diff --git a/src/client/httplibs/juliaweb_http.jl b/src/client/httplibs/juliaweb_http.jl index a8e4975..c1b4e4c 100644 --- a/src/client/httplibs/juliaweb_http.jl +++ b/src/client/httplibs/juliaweb_http.jl @@ -373,9 +373,14 @@ function _http_streaming_request(ctx, method, url, headers, body, timeout, bytes # read-idle timeout. Mirrors the `:downloads` backend, which interrupts # its download task on channel close. try + # Block until the consumer closes the channel. Do NOT use + # `wait(stream_to)`: it returns as soon as data is AVAILABLE, so + # while an event sits in the channel not yet consumed, a + # wait+yield loop degenerates into a hot spin that burns a full + # core in scheduler/syscall overhead. Poll `isopen` instead; + # 250ms of extra abort latency is irrelevant here. while isopen(stream_to) - wait(stream_to) - yield() + sleep(0.25) end catch ex isa(ex, InvalidStateException) || rethrow(ex)