Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions integration-tests/tests/async.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ test.serial("Database.interrupt()", async (t) => {
const db = t.context.db;
const stmt = await db.prepare("WITH RECURSIVE infinite_loop(n) AS (SELECT 1 UNION ALL SELECT n + 1 FROM infinite_loop) SELECT * FROM infinite_loop;");
const fut = stmt.all();
// Wait for the query to start executing on the tokio runtime before
// interrupting, otherwise the interrupt flag may be set before the first
// sqlite3_step() and get consumed without effect on some platforms.
await new Promise(resolve => setTimeout(resolve, 100));
db.interrupt();
await t.throwsAsync(async () => {
await fut;
Expand All @@ -359,6 +363,7 @@ test.serial("Statement.interrupt()", async (t) => {
const db = t.context.db;
const stmt = await db.prepare("WITH RECURSIVE infinite_loop(n) AS (SELECT 1 UNION ALL SELECT n + 1 FROM infinite_loop) SELECT * FROM infinite_loop;");
const fut = stmt.all();
await new Promise(resolve => setTimeout(resolve, 100));
stmt.interrupt();
await t.throwsAsync(async () => {
await fut;
Expand Down
Loading