From e82f822efb34eefdbd540d9fff4a1901d8fcd8ff Mon Sep 17 00:00:00 2001 From: Matthew Keil Date: Thu, 30 Nov 2023 22:15:21 -0500 Subject: [PATCH 1/2] fix: race condition in unit test --- test/multithreading-test.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/multithreading-test.js b/test/multithreading-test.js index 74e58d1..d2a8d54 100644 --- a/test/multithreading-test.js +++ b/test/multithreading-test.js @@ -25,12 +25,13 @@ test('check multithreading flag works as expected', async function (t) { t.plan(9) const location = tempy.directory() const db1 = new ClassicLevel(location) - const db2 = new ClassicLevel(location) - - // check that must set multithreading flag on all instances await db1.open() t.is(db1.location, location) + + // check that must set multithreading flag on all instances + let db2 try { + db2 = new ClassicLevel(location) await db2.open({ multithreading: true }) } catch (err) { t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN', 'second instance failed to open') From 85d1145696a87a63a88d087ac4bb557dc9906af1 Mon Sep 17 00:00:00 2001 From: Matthew Keil Date: Thu, 30 Nov 2023 22:19:27 -0500 Subject: [PATCH 2/2] chore: lint fix --- test/multithreading-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/multithreading-test.js b/test/multithreading-test.js index d2a8d54..41f03c0 100644 --- a/test/multithreading-test.js +++ b/test/multithreading-test.js @@ -27,7 +27,7 @@ test('check multithreading flag works as expected', async function (t) { const db1 = new ClassicLevel(location) await db1.open() t.is(db1.location, location) - + // check that must set multithreading flag on all instances let db2 try {