drbrain / net-http-persistent

Thread-safe persistent connections with Net::HTTP
http://seattlerb.rubyforge.org/net-http-persistent
339 stars 117 forks source link

Add #shutdown to the example #20

Closed softwaregravy closed 12 years ago

softwaregravy commented 12 years ago

reference: https://github.com/drbrain/net-http-persistent/issues/19

drbrain commented 12 years ago

I'll add #shutdown to the example, but I'm going to change the wording since it should not be necessary in normal operation, instead the #idle_timeout setting should be reduced to just below the amount of time the server will keep the connection open to prevent "too many connection resets".

shutdown was designed for tasks that will not make HTTP requests again or have tight resource constraints (using many file descriptors), so it should not be necessary for most users. As such, I'll add more description of why and when you should use #shutdown.

See also (upcoming) comment in #19

softwaregravy commented 12 years ago

Sure thing. Thanks again.

softwaregravy commented 12 years ago

PS my use case was that I was doing this in batches -- rake tasks in delayed job, mostly with 1 worker. So all my batches would have been run on the same thread.