mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-25 02:52:11 +02:00
web/task-manager/runner: proper error codes, remove debug logging
This commit is contained in:
parent
9d129bc865
commit
4a6f159e06
@ -11,8 +11,6 @@ export const runFetchWorker = async (workerId: string, parentId: string, url: st
|
|||||||
|
|
||||||
const unsubscribe = queue.subscribe((queue: CobaltQueue) => {
|
const unsubscribe = queue.subscribe((queue: CobaltQueue) => {
|
||||||
if (!queue[parentId]) {
|
if (!queue[parentId]) {
|
||||||
// TODO: remove logging
|
|
||||||
console.log("worker's parent is gone, so it killed itself");
|
|
||||||
killWorker(worker, unsubscribe);
|
killWorker(worker, unsubscribe);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -34,22 +34,16 @@ export const runFFmpegWorker = async (
|
|||||||
startAttempts++;
|
startAttempts++;
|
||||||
if (startAttempts <= 10) {
|
if (startAttempts <= 10) {
|
||||||
killWorker(worker, unsubscribe, startCheck);
|
killWorker(worker, unsubscribe, startCheck);
|
||||||
console.error("worker didn't start after 5 seconds, so it was killed and started again");
|
|
||||||
return await runFFmpegWorker(workerId, parentId, files, args, output, variant);
|
return await runFFmpegWorker(workerId, parentId, files, args, output, variant);
|
||||||
} else {
|
} else {
|
||||||
killWorker(worker, unsubscribe, startCheck);
|
killWorker(worker, unsubscribe, startCheck);
|
||||||
console.error("worker didn't start after 10 attempts, so we're giving up");
|
return itemError(parentId, workerId, "queue.worker_didnt_start");
|
||||||
|
|
||||||
// TODO: proper error code
|
|
||||||
return itemError(parentId, workerId, "worker didn't start");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
const unsubscribe = queue.subscribe((queue: CobaltQueue) => {
|
const unsubscribe = queue.subscribe((queue: CobaltQueue) => {
|
||||||
if (!queue[parentId]) {
|
if (!queue[parentId]) {
|
||||||
// TODO: remove logging
|
|
||||||
console.log("worker's parent is gone, so it killed itself");
|
|
||||||
killWorker(worker, unsubscribe, startCheck);
|
killWorker(worker, unsubscribe, startCheck);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -64,11 +58,10 @@ export const runFFmpegWorker = async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
worker.onerror = (e) => {
|
worker.onerror = (e) => {
|
||||||
console.error("ffmpeg worker exploded:", e);
|
console.error("ffmpeg worker crashed:", e);
|
||||||
killWorker(worker, unsubscribe, startCheck);
|
killWorker(worker, unsubscribe, startCheck);
|
||||||
|
|
||||||
// TODO: proper error code
|
return itemError(parentId, workerId, "queue.generic_error");
|
||||||
return itemError(parentId, workerId, "internal error");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let totalDuration: number | null = null;
|
let totalDuration: number | null = null;
|
||||||
@ -79,9 +72,6 @@ export const runFFmpegWorker = async (
|
|||||||
|
|
||||||
clearInterval(startCheck);
|
clearInterval(startCheck);
|
||||||
|
|
||||||
// temporary debug logging
|
|
||||||
console.log(JSON.stringify(eventData, null, 2));
|
|
||||||
|
|
||||||
if (eventData.progress) {
|
if (eventData.progress) {
|
||||||
if (eventData.progress.duration) {
|
if (eventData.progress.duration) {
|
||||||
totalDuration = eventData.progress.duration;
|
totalDuration = eventData.progress.duration;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user