问题描述
我使用 Gunicorn 在 Heroku 上部署了一个 Flask 应用程序。有些进程需要比默认的 30 秒更长的时间,所以我需要使用 --timeout 设置。
当我在计算机上运行 gunicorn --workers=4 --timeout=300 app:app
时,没有问题。但是,当我使用包含 web: gunicorn --workers=4 --timeout=300 app:app
的 procfile 将它部署到 Heroku 上时,应用运行良好,但超时仍然默认为 30 秒。
当我检查 Heroku 日志时,这是我在 30 秒后收到的错误消息。请注意 503 状态。
2021-01-15T01:57:01.545230+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/api" host=counterpoint-server.herokuapp.com request_id=0865b365-e8de-48f1-bf94-6325206ec7df fwd="73.165.51.85" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
知道为什么我的 Gunicorn 设置在生产中被忽略了吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)