Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
losfair committed Dec 17, 2023
1 parent f571b80 commit cc47c14
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
4 changes: 4 additions & 0 deletions denokv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ authors.workspace = true
[lib]
path = "lib.rs"

[features]
bundled = ["rusqlite/bundled"]

[dependencies]
anyhow.workspace = true
async-stream.workspace= true
Expand Down
29 changes: 16 additions & 13 deletions sqlite/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))),
Expand Down

0 comments on commit cc47c14

Please sign in to comment.