mirror of
https://github.com/imputnet/cobalt.git
synced 2026-02-12 00:44:02 +00:00
web/queue: in-place queue task retrying
Some checks failed
Run tests / check lockfile correctness (push) Has been cancelled
Run tests / web sanity check (push) Has been cancelled
Run tests / api sanity check (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
Some checks failed
Run tests / check lockfile correctness (push) Has been cancelled
Run tests / web sanity check (push) Has been cancelled
Run tests / api sanity check (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
no more duplicate tasks
This commit is contained in:
@@ -15,6 +15,8 @@ const startPipeline = (pipelineItem: CobaltPipelineItem) => {
|
||||
startWorker(pipelineItem);
|
||||
}
|
||||
|
||||
// this is really messy, sorry to whoever
|
||||
// reads this in the future (probably myself)
|
||||
export const schedule = () => {
|
||||
const queueItems = get(queue);
|
||||
const ongoingTasks = get(currentTasks);
|
||||
@@ -58,7 +60,13 @@ export const schedule = () => {
|
||||
}
|
||||
|
||||
// start the nearest waiting task and wait to be called again
|
||||
else if (task.state === "waiting" && task.pipeline.length > 0) {
|
||||
else if (task.state === "waiting" && task.pipeline.length > 0 && Object.keys(ongoingTasks).length === 0) {
|
||||
// this is really bad but idk how to prevent tasks from running simultaneously
|
||||
// on retry if a later task is running & user restarts an old task
|
||||
for (const task of Object.values(queueItems)) {
|
||||
if (task.state === "running") return;
|
||||
}
|
||||
|
||||
startPipeline(task.pipeline[0]);
|
||||
|
||||
// break because we don't want to start next tasks before this one is done
|
||||
|
||||
Reference in New Issue
Block a user