Skip to content

Commit

Permalink
fix(core): add busy handler for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli committed Oct 9, 2024
1 parent c3f57ba commit 3cf739f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/nx/src/native/db/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use rusqlite::OpenFlags;
use std::fs::{create_dir_all, remove_file};
use std::path::PathBuf;
use std::time::Duration;

use crate::native::machine_id::get_machine_id;
use napi::bindgen_prelude::External;
Expand Down Expand Up @@ -80,5 +81,8 @@ fn create_connection(db_path: &PathBuf) -> anyhow::Result<Connection> {
// This makes things less synchronous than default
c.pragma_update(None, "synchronous", "NORMAL")?;

c.busy_timeout(Duration::from_millis(350))?;
c.busy_handler(Some(|tries| tries < 6))?;

Ok(c)
}

0 comments on commit 3cf739f

Please sign in to comment.