I am making extension for Mopidy. When I exit mopidy with ctrl+c my mopidy doesnt exit completely my thread still runs. How to detect mopidy exiting and stop my tread? can I get that from mopidy.core?
I know this topic is quite old, but I stumbled on the same problem and in case anyone else in the future lands on this page:
You can use the default Pykka ThreadingActor methods in your class. One of them is on_stop which is fired when mopidy is shutting down. More information: https://www.pykka.org/en/latest/api/#pykka.Actor.on_stop
def on_stop(self): self.thread.stop()