Is it possible write custom processing code for a Sanic App to process signals sent to it using its PID?
I am maintaining a list of worker PID’s and want to send signals to specific workers. The reason is that my sanic app spawns threads, and I need to kill specific threads which I am planning to do by sending signals to specific workers.
Currently sanic seems to handle all the signals, and am not able to define a signal handler in my sanic app.
I looked at the parameter in app.run … register_sys_signals and not sure how to use it.
Pls down vote this question. I realized that due to the async nature of sanic, it is not possible to track sanic app spawned threads to specific workers. The issue was to kill threads created in response to a websocket request, when the websocket closed, and the easier way was to catch the asyncio CancelledError exception on websocket operations and use that to kill the associated threads.