po5 / thumbfast

High-performance on-the-fly thumbnailer script for mpv
Mozilla Public License 2.0
760 stars 34 forks source link

Clean up before quitting #33

Closed christoph-heinrich closed 1 year ago

christoph-heinrich commented 1 year ago

After testing for a while I've noticed that there were still mpv processes running and there were tons of thumbnails and sockets in /tmp/. We should clean up after ourselves.

po5 commented 1 year ago

I don't think that will fix stray processes, as they're supposed to already get killed when the current file is closed.
In the case that the main mpv doesn't exit cleanly we can't do much.
Have a lua script running on the slave that calls quit when the socket is gone?

christoph-heinrich commented 1 year ago

Have a lua script running on the slave that calls quit when the socket is gone?

Seems like a good idea, but I'll be testing it this way for a while to see if it makes a difference.

Actually now that I think of it, maybe those stray processes were from when the main instance crashed? In that case the sockets also wouldn't get deleted. In that case inserting a heart beat into both scripts and if the slave doesn't receive a message long enough it terminates and cleans up after itself, just like the main process would if it quits properly.