Skip to content

Commit 7532ac0

Browse files
committed
docs: correct what the per-pid port offset is actually for
The comment credited the modulus with separating concurrent runs of this file. No runner here produces those: each runner runs a given file once, and the node and bun runs are sequential CI steps. The base is what separates this file from its siblings; the offset is only defensive against a leftover socket lingering in TIME_WAIT, which is what dev-hot-reload.mjs already says about the identical construct. Two sibling files gave incompatible accounts of the same mechanism and this one was wrong.
1 parent 6696c33 commit 7532ac0

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

test/bun/dev-public-before-warm.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ const runtime = process.versions.bun ? `bun ${process.versions.bun}` : `node ${p
4141
// overlap each other freely. That is pre-existing and not this file's to fix;
4242
// what this file can do is sit entirely ABOVE all of them. 9989 is the highest
4343
// port any of them reaches, so 10000-10255 cannot collide with any of the four
44-
// for any pair of pids. The modulus then separates concurrent RUNS of this
45-
// file, which is the only collision left. Both halves matter, because the node
46-
// runner schedules the `*.test.mjs` wrappers concurrently in separate child
47-
// processes with near-consecutive pids.
44+
// for any pair of pids. The per-pid offset is NOT doing that work and should
45+
// not be credited with it: the node and bun runs are sequential steps and each
46+
// runner runs a given file once, so nothing here races for a port. It is only
47+
// defensive against a leftover socket from a prior run lingering in TIME_WAIT,
48+
// which is the same account `dev-hot-reload.mjs` gives of the identical
49+
// `base + pid % n` construct.
4850
const PORT = 10000 + (process.pid % 256);
4951
const BASE = `http://localhost:${PORT}`;
5052

0 commit comments

Comments
 (0)