如何在 Tornado 服务器中设置请求超时?
How to set the request timeout in a Tornado server?
我是 运行 kaldi 的 gstreamer server,它在内部使用 tornado 来提供用于转录的 HTTP 端点,例如example.com:8888/dynamic/recognize
我认为这是相关代码:
class Application(tornado.web.Application):
def __init__(self):
settings = dict(
template_path=os.path.join(os.path.dirname(os.path.dirname(__file__)), "templates"),
static_path=os.path.join(os.path.dirname(os.path.dirname(__file__)), "static"),
autoescape=None,
)
handlers = [
[...]
(r"/client/dynamic/recognize", HttpChunkedRecognizeHandler),
[...],
]
tornado.web.Application.__init__(self, handlers, **settings)
我不熟悉 Tornado,但查看 tornado.web.Application
docs,我没有在 settings
.
中看到任何关于超时的提及
我看到了其他几个类似的问题,例如this one, but they deal with the client side. This answer 似乎相关,但我不确定如何在我的案例中应用它。
Tornado 没有通用的超时机制,因为它经常用于 long-polling 和类似的请求。应用程序(在本例中为 gstreamer)负责管理它想要自行设置的任何超时。
我是 运行 kaldi 的 gstreamer server,它在内部使用 tornado 来提供用于转录的 HTTP 端点,例如example.com:8888/dynamic/recognize
我认为这是相关代码:
class Application(tornado.web.Application):
def __init__(self):
settings = dict(
template_path=os.path.join(os.path.dirname(os.path.dirname(__file__)), "templates"),
static_path=os.path.join(os.path.dirname(os.path.dirname(__file__)), "static"),
autoescape=None,
)
handlers = [
[...]
(r"/client/dynamic/recognize", HttpChunkedRecognizeHandler),
[...],
]
tornado.web.Application.__init__(self, handlers, **settings)
我不熟悉 Tornado,但查看 tornado.web.Application
docs,我没有在 settings
.
我看到了其他几个类似的问题,例如this one, but they deal with the client side. This answer 似乎相关,但我不确定如何在我的案例中应用它。
Tornado 没有通用的超时机制,因为它经常用于 long-polling 和类似的请求。应用程序(在本例中为 gstreamer)负责管理它想要自行设置的任何超时。