08-02-2023, 04:25 PM
I am implementing a system that uses APScheduler (which uses thread pool) in order to fetch some resources.
I am trying to figure out a way to detect "app restart" so that I will be able to shut down APScheduler thread pool. I'm restarting by sending SIGHUP to uWSGI master process.
Has anyone tried one of these before? If so, what is the correct way to detect an app restart event?
- `uwsgidecorators` has `postfork` decorator,
- `uwsgi` module has `signal_wait` and `signal_received` functions
`signal_wait` function blocks so my threads run but uWSGI doesn't serve requests. I have also tried setting `scheduler.daemonic` to False and True - it doesn't help either way. The uWSGI process still logs something like this:
`worker 1 (pid: 20082) is taking too much time to die...NO MERCY !!!`
I am trying to figure out a way to detect "app restart" so that I will be able to shut down APScheduler thread pool. I'm restarting by sending SIGHUP to uWSGI master process.
Has anyone tried one of these before? If so, what is the correct way to detect an app restart event?
- `uwsgidecorators` has `postfork` decorator,
- `uwsgi` module has `signal_wait` and `signal_received` functions
`signal_wait` function blocks so my threads run but uWSGI doesn't serve requests. I have also tried setting `scheduler.daemonic` to False and True - it doesn't help either way. The uWSGI process still logs something like this:
`worker 1 (pid: 20082) is taking too much time to die...NO MERCY !!!`