Reputation: 86075
Currently I am spawning HTTP server within my program programmatically.
srv = Thin::Server.start('0.0.0.0', 3000, app)
And I can't figure out where should I see to change keep-alive time setting. Because thin server do not die immediately, it bothers me when debugging and developing app. I will turn on the keep-alive for production, but still I want to control the duration.
Upvotes: 1
Views: 675
Reputation: 86075
# Thin::Server.stop! doesn't work immediately if there's live keep-alive connection.
# SIGINT doesn't work.
# Only SIGKILL works.
# But `abort` is a lot quicker way.
# Overridden to abort.
trap("INT") { puts " Force quit by raising intentional crash!" ;abort() }
Upvotes: 0
Reputation: 2679
If you want it not to wait for pending requests to be served, then just call stop!
:
if RAKE_ENV=='production'
srv.stop
else
srv.stop!
end
Upvotes: 1