Skip to content

Commit b87b80c

Browse files
committed
test(desktop): release the held Stop in a finally
1 parent f94e7cf commit b87b80c

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

‎apps/sim/lib/desktop/executor/supervisor.integration.ts‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -548,16 +548,19 @@ describe.runIf(Boolean(redisUrl))('desktop call supervision and turn binding', (
548548
error: 'offline',
549549
deadlinePassed: false,
550550
})
551-
await expect
552-
.poll(async () => {
553-
const [waiter] = await db.execute<{ pid: number }>(sql`
554-
SELECT pid FROM pg_stat_activity WHERE wait_event_type = 'Lock'
555-
AND ${stopPid}::int = ANY(pg_blocking_pids(pid)) LIMIT 1`)
556-
return Boolean(waiter)
557-
})
558-
.toBe(true)
559-
releaseStop.resolve()
560-
await stopping
551+
try {
552+
await expect
553+
.poll(async () => {
554+
const [waiter] = await db.execute<{ pid: number }>(sql`
555+
SELECT pid FROM pg_stat_activity WHERE wait_event_type = 'Lock'
556+
AND ${stopPid}::int = ANY(pg_blocking_pids(pid)) LIMIT 1`)
557+
return Boolean(waiter)
558+
})
559+
.toBe(true)
560+
} finally {
561+
releaseStop.resolve()
562+
await stopping
563+
}
561564

562565
await expect(settling).resolves.toBe(false)
563566
expect((await row(toolCallId)).status).toBe('pending')

0 commit comments

Comments
 (0)