I have an extension that runs a background timer thread. I've noticed that this thread creates long delays when shutting down the Mopidy service. My hunch is that nothing is automatically killing the thread when the service shuts down.
The extension is structured so that a singleton instance of the main class is created in Extension.setup(). At this point is there a way to register for a callback when Mopidy shuts down?
I looked at Mopidy-GMusic which does something similar but it seems to be using some sort of Pykka magic to shut down its thread that I am not sure I follow. Is it only possible because it is a backend extension?