Skip to content

Commit a858019

Browse files
committed
test(metrics-pipeline,run-engine): readiness wait for the per-stream test, honest timer comment
The per-stream batches test carried the same first-emission drop race as its siblings; it now waits for the emitter connection too. The readiness helper's comment claimed a losing race branch rejects unhandled, which is not how Promise.race behaves (it handles every input); the abort's real benefit is releasing the timer promptly.
1 parent 3707f85 commit a858019

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎internal-packages/metrics-pipeline/src/consumer.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ redisTest(
157157
});
158158

159159
await consumer.start();
160+
await emitter.waitUntilReady();
160161
emitter.emit(a, { op: "enqueue", q: a });
161162
emitter.emit(b, { op: "enqueue", q: b });
162163
await waitFor(() => inserted.flatMap((i) => i.rows).length >= 2);

‎internal-packages/run-engine/src/run-queue/metrics.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const authenticatedEnvDev = {
2626

2727
// A dead Redis leaves waitUntilReady() pending forever (the client retries
2828
// indefinitely), which would burn the whole test timeout with no diagnostic.
29-
// Races values, not throws: a rejection in the losing branch of a settled race
30-
// is an unhandled rejection, so the timer is aborted and swallowed instead.
29+
// The abort releases the losing timer promptly so it cannot hold an event
30+
// loop open for the remaining 15s after a fast ready.
3131
async function emitterReady(emitter: MetricsStreamEmitter) {
3232
const abort = new AbortController();
3333
const timedOut = setTimeout(15_000, "timeout", { signal: abort.signal }).catch(() => "aborted");

0 commit comments

Comments
 (0)