mirror of
https://github.com/imputnet/cobalt.git
synced 2025-12-18 14:08:51 +00:00
web/queue: add remuxing progress & general improvements
and a bunch of other stuff: - size and percentage in queue - indeterminate progress bar - if libav wasm freezes, the worker kill itself - cleaner states - cleaner props
This commit is contained in:
@@ -10,9 +10,9 @@ const currentTasks = readable<CobaltCurrentTasks>(
|
||||
(_, _update) => { update = _update }
|
||||
);
|
||||
|
||||
export function addWorkerToQueue(item: CobaltCurrentTaskItem) {
|
||||
export function addWorkerToQueue(workerId: string, item: CobaltCurrentTaskItem) {
|
||||
update(tasks => {
|
||||
tasks[item.id] = item;
|
||||
tasks[workerId] = item;
|
||||
return tasks;
|
||||
});
|
||||
}
|
||||
@@ -24,10 +24,10 @@ export function removeWorkerFromQueue(id: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function updateWorkerProgress(id: string, progress: CobaltWorkerProgress) {
|
||||
update(tasks => {
|
||||
tasks[id].progress = progress;
|
||||
return tasks;
|
||||
export function updateWorkerProgress(workerId: string, progress: CobaltWorkerProgress) {
|
||||
update(allTasks => {
|
||||
allTasks[workerId].progress = progress;
|
||||
return allTasks;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ export function itemDone(id: string, workerId: string, file: File) {
|
||||
checkTasks();
|
||||
}
|
||||
|
||||
export function itemRunning(id: string, step: number) {
|
||||
export function itemRunning(id: string, workerId: string) {
|
||||
update(queueData => {
|
||||
if (queueData[id]) {
|
||||
queueData[id] = {
|
||||
...queueData[id],
|
||||
state: "running",
|
||||
currentStep: step,
|
||||
runningWorker: workerId,
|
||||
}
|
||||
}
|
||||
return queueData;
|
||||
@@ -68,6 +68,10 @@ export function itemRunning(id: string, step: number) {
|
||||
|
||||
export function removeItem(id: string) {
|
||||
update(queueData => {
|
||||
for (const worker in queueData[id].pipeline) {
|
||||
removeWorkerFromQueue(queueData[id].pipeline[worker].workerId);
|
||||
}
|
||||
|
||||
delete queueData[id];
|
||||
return queueData;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user