-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce body allocation and copying #475
Conversation
…some duplication between JSON and Transit support.
…he JSON and Transit memory optimizations.
Greetings - we recently upgraded to clj-http 3.10.0. The following doesn't work in 3.10.0, but it worked in 3.9.1. In 3.10.0, we get a java.io.IOException Stream Closed error If we remove :as :json, we don't get that error, but the body isn't coerced to a clj map. I'm planning on looking through changes leading up to 3.10.0, but before I did that, I figured that I'd post the error for early awareness. |
Connections are not closing immediately after coercing the body using transit. This is a regression introduced in #475. Previously, the response body always was also transferred into an intermediate byte-array which will read bytes until the stream is empty, and automatically close the connection. Since we no longer have this implicit behavior, the body coercion middleware must close the inputstream after reading a value. Fixes #564
Connections are not closing immediately after coercing the body using transit. This is a regression introduced in #475. Previously, the response body always was also transferred into an intermediate byte-array which will read bytes until the stream is empty, and automatically close the connection. Since we no longer have this implicit behavior, the body coercion middleware must close the inputstream after reading a value. Fixes #564
Removes various intermediate byte arrays and strings in body decoding that were unnecessary. JSON and Transit decoding get the most benefit.
I didn't have time to figure out every format and it seems that some of them would need changes to other libraries like
ring.util.codec
. dakrone/cheshire#139 would also enable a bit more gains for JSON decoding.