Automatic bulb reload and long thread

I use a long thread in a Flask application. In debug mode, when restart is activated, a long thread does not restart when reboot.

Instead, since the code that creates and starts the thread runs after a reboot, each loop creates an additional thread.

How can I prevent this other than shutting down the reloader?

Will the same thing happen when working in mod_wsgi with the autoload function?

Update : a long thread was actually killed by Werkzeug on reboot. There is an extra copy that, due to a reboot, Werkzeug accepts an extra thread that runs the initialization code.

+4
python flask werkzeug wsgi mod-wsgi
source share
1 answer

A reboot of mod_wsgi is described in:

http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

In the case of a long request by default, if it does not complete within 5 seconds, the process will be forcedly killed in any case. This is done in order to avoid blocking the process, because the request will not be completed.

+3
source share

All Articles