fix: guard run completion boundary
This commit is contained in:
1 parent
245586a9aa
commit
d21edb244f
6 files changed
+268
-8
No files matched your search
@@ -90,11 +90,14 @@ async function startRun(job: RunJob) {
|
||||
await runner.run(job);
|
||||
} finally {
|
||||
cancelledRuns.delete(job.runId);
|
||||
active.delete(job.runId);
|
||||
tickQueue();
|
||||
}
|
||||
}
|
||||
|
||||
function acknowledgeRunCompletion(runId: string) {
|
||||
const released = active.delete(runId);
|
||||
if (released) tickQueue();
|
||||
}
|
||||
|
||||
function cancelRun(runId: string) {
|
||||
const queuedIndex = queue.findIndex((entry) => entry.runId === runId);
|
||||
if (queuedIndex >= 0) {
|
||||
@@ -129,6 +132,10 @@ parentPort.on("message", (event) => {
|
||||
cancelRun(message.runId);
|
||||
return;
|
||||
}
|
||||
if (message.type === "run-completion-ack") {
|
||||
acknowledgeRunCompletion(message.runId);
|
||||
return;
|
||||
}
|
||||
if (message.type === "steer-run") {
|
||||
const accepted = runner.steer(message.runId, message.message);
|
||||
post({
|
||||
|
||||
Reference in new issue
Block a user