Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to using a new HTTP client for each twirp client request
Ideally Crystal's HTTP client would manage a pool of connections and reuse them when appropriate, but it does not – see crystal-lang/crystal#6011 – so using a new TCP connection for each request seems like the safest approach. The previous implementation was hopelessly broken due to the `@client.close`, which resulted in `Closed stream (IO::Error)` errors when used concurrently... However, IIRC, without the explicit close other issues arise when TCP sockets timeout of their own accord.
- Loading branch information