gnarroway / hato

An HTTP client for Clojure, wrapping JDK 11's HttpClient
MIT License
380 stars 27 forks source link

Consider adding a default timeout #18

Open nivekuil opened 4 years ago

nivekuil commented 4 years ago

I think it's pretty much always a good idea to have a default timeout on I/O; it prevents some catastrophic behavior in production that there's really no good reason to allow. Most libraries do this, like the Apache client which clj-http wraps, which defaults to the system timeout: https://stackoverflow.com/questions/9734384/default-timeout-for-httpcomponent-client

Apparently the new Java API which this wraps doesn't set a default timeout, which I think is unfortunate. Would you consider adding one to this library?

gnarroway commented 4 years ago

Hi! Thanks for your interest.

The request doesn’t sound unreasonable. Would you like to open a PR for it? I’ll leave this issue open for the time being in case there are any immediate objections by anyone.

gnarroway commented 4 years ago

For reference, as far as I can see apache hardcodes the various timeouts to 3min as default: https://github.com/apache/httpcomponents-client/blob/fa08f54077ee3c9566437a4aeb801facfa43c4d4/httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java#L45