fix: properly exit app when window is closed - #777
Conversation
|
I will have to think about this and its side-effects, I am not so sure I want to exit background workers forcibly. Sadly there is no good way to exit them cleanly without re-implementing them or changing how they work in Legendary. And then there is the matter of making sure that Rare doesn't update any important information in the metadata at the start of the worker, but rather do it at the end. This is not as a simple change, even I do understand why it is desirable. |
|
Personal opinion: it’s better to do this; ensuring the app closes properly than to have an exception or, even worse, an app running in the background when it isn’t needed. |
The application won't run in the background when it's not needed. I agree with handling the SIGINT and SIGTERM is a good idea, but maybe they should be ignored instead if there are active workers. |
At the moment, even if I close it, it keeps running in the background; I always have to force it to close, even from the system tray. At least that way I can close it from the CLI, without having to worry about all sorts of exceptions |
I do not have that behavior, but there is a chance that I expect the behavior and don't notice it, can you run from a terminal and see what it is doing and doesn't exit? |
7cf9808 to
c5c9937
Compare
c5c9937 to
98df875
Compare
|
Sorry, ‘force push’ was because I’d entered the wrong email address |
When I close it, it disconnects from the terminal but remains open (I can see this in Task Manager; "rare" process is still running) |
This doesn't have anything to do with the active worker threads, this is just our exception handler. When you send SIGINT, as you said it gets caught as an KeyboardInterrupt exception, and the exception handler is presented. Arguably this should be handled better, or trigger the interactive shutdown procedure, but it's not immediately related to the worker threads, rather the application keeps on running almost normally depending on your selection in the exception handler. |
|
Thanks, this looks proper now, I went ahead and merged it. |
Fixes the app not exiting for real when the window is closed. Ctrl+C now triggers a clean shutdown instead of a KeyboardInterrupt traceback that PySide6 swallows, and shutdown can no longer hang indefinitely on background workers. Confirming the queue-clear prompt now proceeds with the close instead of ignoring it.