mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Fix nested worker randomly shutting off in Firefox (closes #435)
This commit is contained in:
@@ -192,3 +192,7 @@ if (parentPort) {
|
||||
} else {
|
||||
self.addEventListener('message', event => onMessage(event.data as { id: number; command: WorkerCommand }));
|
||||
}
|
||||
|
||||
// Prevents the worker for being randomly closed by Firefox
|
||||
// https://github.com/Vanilagy/mediabunny/issues/435
|
||||
setInterval(() => {}, 1000);
|
||||
|
||||
@@ -304,3 +304,7 @@ if (parentPort) {
|
||||
} else {
|
||||
self.addEventListener('message', event => onMessage(event.data as { id: number; command: WorkerCommand }));
|
||||
}
|
||||
|
||||
// Prevents the worker for being randomly closed by Firefox
|
||||
// https://github.com/Vanilagy/mediabunny/issues/435
|
||||
setInterval(() => {}, 1000);
|
||||
|
||||
@@ -46,6 +46,7 @@ export const unrefWorker = async () => {
|
||||
if (worker) {
|
||||
if (worker.unref) {
|
||||
worker.unref(); // If we don't do this, then the Node process never terminates by itself
|
||||
// Keep the worker around tho
|
||||
} else if (typeof window === 'undefined') {
|
||||
// Non-browser environment without unref - terminate instead
|
||||
worker.terminate();
|
||||
|
||||
@@ -192,3 +192,7 @@ if (parentPort) {
|
||||
} else {
|
||||
self.addEventListener('message', event => onMessage(event.data as { id: number; command: WorkerCommand }));
|
||||
}
|
||||
|
||||
// Prevents the worker for being randomly closed by Firefox
|
||||
// https://github.com/Vanilagy/mediabunny/issues/435
|
||||
setInterval(() => {}, 1000);
|
||||
|
||||
@@ -219,3 +219,7 @@ if (parentPort) {
|
||||
} else {
|
||||
self.addEventListener('message', event => onMessage(event.data as { id: number; command: WorkerCommand }));
|
||||
}
|
||||
|
||||
// Prevents the worker for being randomly closed by Firefox
|
||||
// https://github.com/Vanilagy/mediabunny/issues/435
|
||||
setInterval(() => {}, 1000);
|
||||
|
||||
Reference in New Issue
Block a user