How to nicely shutdown a python program?
I am writing a worker that gets elements from a queue to process them. I'd like to make sure it will wait to finish to process the current item before stoping.
I am not asking for a solution on the queue part. I'm wondering how I can catch the "exit"/"stop" signal coming from outside the python program if I do Ctrl+C or kill.
Thanks