From cc47c14eef75384204c911671bf2a5843bbb300a Mon Sep 17 00:00:00 2001 From: losfair Date: Sun, 17 Dec 2023 20:00:17 +0800 Subject: [PATCH] fix --- denokv/Cargo.toml | 4 ++++ sqlite/Cargo.toml | 3 --- sqlite/lib.rs | 29 ++++++++++++++++------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/denokv/Cargo.toml b/denokv/Cargo.toml index 9a37eb1..be542c2 100644 --- a/denokv/Cargo.toml +++ b/denokv/Cargo.toml @@ -11,6 +11,10 @@ authors.workspace = true path = "main.rs" name = "denokv" +[features] +default = ["bundled-sqlite"] +bundled-sqlite = ["rusqlite/bundled"] + [dependencies] anyhow.workspace = true aws-config.workspace = true diff --git a/sqlite/Cargo.toml b/sqlite/Cargo.toml index 4243ed9..347f207 100644 --- a/sqlite/Cargo.toml +++ b/sqlite/Cargo.toml @@ -10,9 +10,6 @@ authors.workspace = true [lib] path = "lib.rs" -[features] -bundled = ["rusqlite/bundled"] - [dependencies] anyhow.workspace = true async-stream.workspace= true diff --git a/sqlite/lib.rs b/sqlite/lib.rs index 12ce578..15d811b 100644 --- a/sqlite/lib.rs +++ b/sqlite/lib.rs @@ -225,19 +225,22 @@ impl Sqlite { SqliteBackend::new(conn, notifier.clone(), versionstamp_rng, i != 0)?; let init_fence = init_fence.clone(); let shutdown_notify = shutdown_notify.clone(); - let join_handle: JoinHandle<()> = std::thread::spawn(move || { - tokio::runtime::Builder::new_current_thread() - .enable_all() - .build() - .unwrap() - .block_on(async move { - // We need to fence - let shutdown_notify = shutdown_notify.notified(); - init_fence.wait(); - sqlite_thread(backend, shutdown_notify, request_rx, batch_timeout) - .await - }); - }); + let join_handle: JoinHandle<()> = std::thread::Builder::new() + .name(format!("sw-{}", i)) + .spawn(move || { + tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .unwrap() + .block_on(async move { + // We need to fence + let shutdown_notify = shutdown_notify.notified(); + init_fence.wait(); + sqlite_thread(backend, shutdown_notify, request_rx, batch_timeout) + .await + }); + }) + .unwrap(); workers.push(SqliteWorker { request_tx, join_handle: Arc::new(Mutex::new(Some(join_handle))),