Files
usenet-indexer/tests/unit/coordinator/prober_queue.spec.ts
T
Daan MeijerandClaude Opus 5.5 0ccb850ea4
Test and deploy / deploy (push) Successful in 1m34s
Test and deploy / test (push) Successful in 3m6s
Prober: claim ahead of the lanes, not when they run dry
The next claim started at half a batch of four pipeline rounds a lane,
3-6 s of work, while a claim takes 1.5-4 s and more; at 20-24 lanes the
lanes waited for candidates up to 19% of their time. queueLevels: the
claim starts below eight rounds of every lane's pipeline (~13 s) and
fills the queue to twice that. Taken candidates go back to waiting at
start-up as before, so a bigger queue costs nothing on a restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 14:52:48 +01:00

17 lines
638 B
TypeScript

import { test } from '@japa/runner'
import { queueLevels } from '#services/prober'
test.group('Prober / queue levels', () => {
test('the next claim starts with eight pipeline rounds of every lane still queued, and fills to twice that', ({
assert,
}) => {
assert.deepEqual(queueLevels(22, 8, 400), { low: 1408, target: 2816 })
assert.deepEqual(queueLevels(7, 8, 400), { low: 448, target: 896 })
})
test('few lanes: at least the configured batch', ({ assert }) => {
assert.deepEqual(queueLevels(2, 8, 400), { low: 400, target: 800 })
assert.deepEqual(queueLevels(0, 8, 400), { low: 400, target: 800 })
})
})