Sheraff / soft-serve-tunes

Self hosted music server on raspberry pi
7 stars 0 forks source link

handle SIGINT / SIGTERM to store long-running tasks #28

Open Sheraff opened 1 year ago

Sheraff commented 1 year ago

to verify: I think some tasks might be non-recoverable if interrupted. For example, fetching a track on Spotify is supposed to then fetch the album and artist and won't ever do so if interrupted after the track.

If there are cases like this, we should listen for sigint or other termination signals and store some recoverable state in database before exiting.

Sheraff commented 1 year ago

Kill websocket server on signals: https://github.com/Sheraff/soft-serve-tunes/commit/2233551371794c60e83edb94a35fea7bf6f26cd5

Sheraff commented 1 year ago

Disconnect prisma client on signals: https://github.com/Sheraff/soft-serve-tunes/commit/7f74bf0898e1cd202d4abde559bfac73cb0fad81