Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/gate-wait.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export function gateWaitReporter(io) {
let last = '';
let warned = false;
let held = false;
return ({ holders, position, memory, runnerUnavailable }) => {
return ({ holders = [], position, memory, runnerUnavailable, admitted }) => {
// An inherited gate slot is admitted at once: there is no queue to describe.
if (admitted) return;
if (runnerUnavailable) {
io.say(`runner ${runnerUnavailable.host} unavailable: ${runnerUnavailable.reason}; until ${runnerUnavailable.until}; requeueing the run`);
return;
Expand Down
12 changes: 12 additions & 0 deletions test/gate-wait-admitted.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { gateWaitReporter } from '../src/gate-wait.js';

// A run that inherits its parent's gate slot (a frozen check calling pullboard test inside submit)
// is admitted at once and reports no holders; it must not crash the submit.
test('an admitted run that inherited the gate slot says nothing and does not throw', () => {
const said = [];
const report = gateWaitReporter({ say: (line) => said.push(line) });
assert.doesNotThrow(() => report({ admitted: true }));
assert.deepEqual(said, []);
});