【发布时间】:2012-11-25 02:14:30
【问题描述】:
Thin 的代码/文档建议默认连接超时为 30 秒。但是,当我尝试对此进行测试时,它似乎不起作用。我错过了什么?
我使用的是thin v1.5.0(最新)。
# Test this using: curl -X GET http://localhost:3000/test. You will find that the request does not
# timeout after 30s.
require 'thin'
class SimpleAdapter
def call(env)
sleep 100
body = ["hello!"]
[
200,
{ 'Content-Type' => 'text/plain' },
body
]
end
end
server = Thin::Server.new('127.0.0.1', 3000) do
map '/test' do
run SimpleAdapter.new
end
end
server.start!
【问题讨论】:
-
您能否参考建议 30 秒超时的文档?
-
如果你看代码,DEFAULT_TIMEOUT 设置为 30s。此外,如果您使用命令行运行器并执行“thin -h”,则帮助建议如下:“-t, --timeout SEC 请求或命令超时秒(默认值:30)”。
标签: ruby http timeout webserver thin