The par2 prune gets 2 min per round (it held the merges back for hours); abandoned ranges past their end are finished
Test and deploy / test (push) Successful in 52s
Test and deploy / edge (push) Successful in 1m57s
Test and deploy / deploy (push) Successful in 2m42s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-17 20:42:14 +02:00
1 parent c55918350e
commit aa20d6b79f
6 files changed
+41 -4

No files matched your search

+7
View File
@@ -31,5 +31,12 @@ test.group('Leases', (group) => {
// a1's worker went quiet: its lease is taken over (a2 alone counts).
await db.from('ranges').where('id', a1).update({ heartbeat_at: new Date(Date.now() - 24 * 3600_000) })
assert.equal(await leased(5), a1)
// Read to its end, its worker gone before finishing: done. One still reading, or quiet but not at its end, stays.
await db.from('ranges').where('id', a2).update({ next_id: 201, heartbeat_at: new Date(Date.now() - 24 * 3600_000) })
await db.from('ranges').where('id', b1).update({ next_id: 101 })
assert.equal(await Leases.finishAbandoned(), 1)
assert.equal((await db.from('ranges').where('id', a2).firstOrFail()).status, 'done')
assert.equal((await db.from('ranges').where('id', b1).firstOrFail()).status, 'leased')
})
})
+4 -1
View File
@@ -53,8 +53,11 @@ test.group('Par2Pruner', (group) => {
const locked = await set('e', e, 2, null)
await db.table('release_verdicts').insert({ release_id: e, rule: 'locked', rule_version: 1 })
// Out of budget: the complete pass's batch, not the judged pass (the next round goes on).
assert.deepEqual(await new Par2Pruner().round(0), { complete: 1, judged: 0, rows: 2 })
await db.from('worker_cursors').where('name', 'par2-prune').delete()
const round = await new Par2Pruner().round()
assert.deepEqual(round, { complete: 1, judged: 1, rows: 4 })
assert.deepEqual(round, { complete: 0, judged: 1, rows: 2 })
assert.equal(await count(complete), 0)
assert.equal(await count(apart), 2)
assert.equal(await count(recent), 2)