mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-17 10:00:46 -04:00
server restart stuck fixes
This commit is contained in:
@@ -95,6 +95,7 @@ const workerEngine = createAudioForwardWorkerEngine({
|
||||
const {
|
||||
ensureWorker,
|
||||
stopWorker,
|
||||
stopAllWorkers,
|
||||
playUploadedAudio,
|
||||
playServerAudioFile,
|
||||
stopPlayback,
|
||||
@@ -104,6 +105,21 @@ const {
|
||||
startSilenceWriter,
|
||||
} = workerEngine;
|
||||
|
||||
function installShutdownHooks() {
|
||||
const shutdown = (signal) => {
|
||||
// Audio forwarding owns long-lived ffmpeg publisher/writer pairs. Stop them
|
||||
// synchronously on process signals so a systemd restart does not have to
|
||||
// wait for orphaned media workers to notice that their parent is gone.
|
||||
stopAllWorkers(signal || 'process-exit');
|
||||
};
|
||||
|
||||
process.once('exit', () => shutdown('exit'));
|
||||
process.once('SIGINT', () => shutdown('SIGINT'));
|
||||
process.once('SIGTERM', () => shutdown('SIGTERM'));
|
||||
}
|
||||
|
||||
installShutdownHooks();
|
||||
|
||||
registerAudioForwardHooks({
|
||||
io,
|
||||
roverManager,
|
||||
|
||||
Reference in New Issue
Block a user