gpt4 book ai didi

python - 具有长时间启动和 gunicorn 超时的应用程序

转载 作者:行者123 更新时间:2023-12-05 06:15:27 25 4
gpt4 key购买 nike

我有一个 Flask 应用程序需要一分钟才能启动,但随后应该会迅速响应。目前我正在使用 gunicorn -t 90(如 Running Gunicorn Flask app in Docker [CRITICAL] WORKER TIMEOUT when starting up 中所述)来避免应用程序被杀死,但是它也会影响初始化后的超时。有什么办法可以使它更细粒度吗?有什么方法可以放宽超时设置,直到应用程序发出初始化已完成的信号?或者在应用程序导入完成后收紧它?

最佳答案

您可以尝试设置 preload_app=True或将您的初始化移动到 on_startup在你的 gunicorn_conf.py 中。

关于python - 具有长时间启动和 gunicorn 超时的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62526497/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com