简体   繁体   中英

How to set the request timeout in a Tornado server?

I'm running the gstreamer server for kaldi, which uses tornado internally to provide an HTTP end-point for transcription, eg example.com:8888/dynamic/recognize

I think this is the relevant code:

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)

Source

I'm not familiar with Tornado, but looking at tornado.web.Application docs , I don't see any mention of timeouts in settings .

I saw several other similar questions, eg this one , but they deal with the client side. This answer seems relevant, but I'm not sure how to apply it in my case.

Tornado does not have a generic timeout mechanism since it is often used for long-polling and similar requests. The application (in this case, gstreamer) is responsible for managing whatever timeouts it wants to set on its own.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM