Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App with long startup and gunicorn timeout

I have a flask app that needs a minute to spin up, but then should respond snappily. Currently I am using gunicorn -t 90 (as discussed in Running Gunicorn Flask app in Docker [CRITICAL] WORKER TIMEOUT when starting up) to avoid the app being killed, however it will also affect the timeout after the initialisation. Is there any way to make this more fine-grained? Some way to loosen the timeout setting till the app signals that the initialisation is done? Or tighten it when the import of the app is done?

like image 708
Amadan Avatar asked Oct 23 '25 02:10

Amadan


1 Answers

You could try setting preload_app=True or move your initialization to on_startup in your gunicorn_conf.py.

like image 65
pypae Avatar answered Oct 25 '25 15:10

pypae



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!