【发布时间】:2021-12-07 00:47:47
【问题描述】:
我正在 Heroku 上运行一个 Django 应用程序。
当我发出超过 30 秒的请求时,它会停止并且请求返回 503 Service Unavailable。
这些是heroku日志
2021-10-20T07:11:14.726613+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/ajax/download_yt/" host=yeti-mp3.herokuapp.com request_id=293289be-6484-4f11-a62d-bda6d0819351 fwd="79.3.90.79" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
我尝试对此进行一些研究,发现我可以在 Procfile 中增加 gunicorn(我使用的是 gunicorn 版本 20.0.4)超时。我尝试增加到 60 秒,但请求在 30 秒后仍然停止。
这是我当前的 Procfile:
web: gunicorn yetiMP3.wsgi --timeout 60 --log-file -
这些是我在 Heroku 应用中使用的构建包:
如何增加请求超时? 我错过了一些heroku配置吗?
【问题讨论】:
-
为什么你有超过 30 秒的响应时间?好像有点过分了
-
这是对下载 youtube 视频的控制器的请求。我应该将其作为后台进程进行,但我想了解我在使用 heroku 配置时做错了什么