[英]How to turn off ruby thin server HTTP keep-alive?
Currently I am spawning HTTP server within my program programmatically. 目前,我正在以编程方式在程序中生成HTTP服务器。
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.
我将为生产启用“保持活动”,但仍然要控制持续时间。
If you want it not to wait for pending requests to be served, then just call stop!
如果您不希望其等待待处理的请求,则只需致电
stop!
: :
if RAKE_ENV=='production'
srv.stop
else
srv.stop!
end
# 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() }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.