diff --git a/node/src/test/test.ts b/node/src/test/test.ts index 32377a39..a970bd8e 100644 --- a/node/src/test/test.ts +++ b/node/src/test/test.ts @@ -93,6 +93,30 @@ describe("LanceDB client", function () { const con = await lancedb.connect(uri); assert.deepEqual(await con.tableNames(), ["vectors"]); }); + + it("read consistency level", async function () { + const uri = await createTestDB(); + const db1 = await lancedb.connect({ uri }); + const table1 = await db1.openTable("vectors"); + + const db2 = await lancedb.connect({ + uri, + readConsistencyInterval: 0 + }) + const table2 = await db2.openTable("vectors"); + + assert.equal(await table2.countRows(), 2); + await table1.add([ + { + id: 3, + name: 'name_2', + price: 10, + is_active: true, + vector: [ 0, 0.1 ] + }, + ]); + assert.equal(await table2.countRows(), 3); + }); }); describe("when querying an existing dataset", function () { diff --git a/rust/ffi/node/src/lib.rs b/rust/ffi/node/src/lib.rs index 54223255..4e4105fa 100644 --- a/rust/ffi/node/src/lib.rs +++ b/rust/ffi/node/src/lib.rs @@ -49,7 +49,7 @@ fn runtime<'a, C: Context<'a>>(cx: &mut C) -> NeonResult<&'static Runtime> { fn database_new(mut cx: FunctionContext) -> JsResult { let path = cx.argument::(0)?.value(&mut cx); let read_consistency_interval = cx - .argument_opt(5) + .argument_opt(2) .and_then(|arg| arg.downcast::(&mut cx).ok()) .map(|v| v.value(&mut cx)) .map(std::time::Duration::from_secs_f64);