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?
Asked
Active
Viewed 910 times
4

Amadan
- 191,408
- 23
- 240
- 301
1 Answers
2
You could try setting preload_app=True
or move your initialization to on_startup
in your gunicorn_conf.py
.

pypae
- 639
- 6
- 16
-
`preload_app` (`--preload` cli flag) made a huge difference for my heroku django app. Thanks! – Taylor Hughes May 06 '22 at 23:43