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) => {
|
||||
if (!queue[parentId]) {
|
||||
// TODO: remove logging
|
||||
console.log("worker's parent is gone, so it killed itself");
|
||||
killWorker(worker, unsubscribe);
|
||||
}
|
||||
});
|
||||
|
@ -34,22 +34,16 @@ export const runFFmpegWorker = async (
|
||||
startAttempts++;
|
||||
if (startAttempts <= 10) {
|
||||
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);
|
||||
} else {
|
||||
killWorker(worker, unsubscribe, startCheck);
|
||||
console.error("worker didn't start after 10 attempts, so we're giving up");
|
||||
|
||||
// TODO: proper error code
|
||||
return itemError(parentId, workerId, "worker didn't start");
|
||||
return itemError(parentId, workerId, "queue.worker_didnt_start");
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
|
||||
const unsubscribe = queue.subscribe((queue: CobaltQueue) => {
|
||||
if (!queue[parentId]) {
|
||||
// TODO: remove logging
|
||||
console.log("worker's parent is gone, so it killed itself");
|
||||
killWorker(worker, unsubscribe, startCheck);
|
||||
}
|
||||
});
|
||||
@ -64,11 +58,10 @@ export const runFFmpegWorker = async (
|
||||
});
|
||||
|
||||
worker.onerror = (e) => {
|
||||
console.error("ffmpeg worker exploded:", e);
|
||||
console.error("ffmpeg worker crashed:", e);
|
||||
killWorker(worker, unsubscribe, startCheck);
|
||||
|
||||
// TODO: proper error code
|
||||
return itemError(parentId, workerId, "internal error");
|
||||
return itemError(parentId, workerId, "queue.generic_error");
|
||||
};
|
||||
|
||||
let totalDuration: number | null = null;
|
||||
@ -79,9 +72,6 @@ export const runFFmpegWorker = async (
|
||||
|
||||
clearInterval(startCheck);
|
||||
|
||||
// temporary debug logging
|
||||
console.log(JSON.stringify(eventData, null, 2));
|
||||
|
||||
if (eventData.progress) {
|
||||
if (eventData.progress.duration) {
|
||||
totalDuration = eventData.progress.duration;
|
||||
|
Loading…
x
Reference in New Issue
Block a user