Skip to content

Commit 30f50b4

Browse files
committed
test(search): bound the wait for the purge to block on the updated rows
1 parent 67d1976 commit 30f50b4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎packages/db/scripts/purge-search-projection.integration.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ describe('Search candidate retirement in PostgreSQL', () => {
316316
// Every candidate row gets a new tuple version, committed only once the purge waits on it.
317317
await tx`UPDATE embedding_search SET enabled = enabled WHERE knowledge_base_id = 'search'`
318318
purge = purgeSearchProjection(sql, { batchSize: 10, pauseMs: 0 })
319-
for (;;) {
319+
for (let attempt = 0; ; attempt++) {
320+
if (attempt === 250) throw new Error('The purge never waited on the updated rows')
320321
const [{ waiting }] = await tx<{ waiting: boolean }[]>`
321322
SELECT EXISTS (SELECT 1 FROM pg_stat_activity
322323
WHERE datname = current_database() AND wait_event_type = 'Lock'

0 commit comments

Comments
 (0)