增加龙卷风/烧瓶安装的超时

时间:2018-10-05 15:25:13

标签: python flask webserver tornado

我有一个如下的Tornado / Flask设置,由于请求时间太长,我收到502网关超时。

如何增加龙卷风的超时时间?我已经看过Tornado的文档,但是找不到相关信息。

import os
from flask import Flask
from flask_cors import CORS
from flask_env import MetaFlaskEnv
from flask_restful import Api
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.wsgi import WSGIContainer
from resources.version import Version


class Configuration(metaclass=MetaFlaskEnv):
    """
    Service configuration
    """

    DEBUG = True
    PORT = 5000

# setup api app
app = Flask(__name__)
app.config.from_object(Configuration)
API = Api(app)

# allow cross site request
CORS = CORS(app, resources={r"/api/*": {"origins": "*"}})

# system endpoints
API.add_resource(Version, '/api/v1/version')


if __name__ == '__main__': # pragma: no covers
    # start server
    HTTP_SERVER = HTTPServer(WSGIContainer(app))
    HTTP_SERVER.listen(port=app.config["PORT"])

    num_process = int(os.environ.get('NUM_PROCESS', 4))
    HTTP_SERVER.start(num_process)

    IOLoop.instance().start()

1 个答案:

答案 0 :(得分:1)

Tornado没有任何会导致返回502的超时。这一定来自系统的其他部分(也许是nginx或haproxy吗?)