From 27b7c3a64346262708572762f85b88b7cecbaa48 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 9 Oct 2024 14:05:58 -0700 Subject: [PATCH] fix(core): add busy handler for sqlite --- packages/nx/src/native/db/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/nx/src/native/db/mod.rs b/packages/nx/src/native/db/mod.rs index 90ca66f32fa34..0c4838ee99756 100644 --- a/packages/nx/src/native/db/mod.rs +++ b/packages/nx/src/native/db/mod.rs @@ -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; @@ -80,5 +81,8 @@ fn create_connection(db_path: &PathBuf) -> anyhow::Result { // This makes things less synchronous than default c.pragma_update(None, "synchronous", "NORMAL")?; + c.busy_timeout(Duration::from_millis(25))?; + c.busy_handler(Some(|tries| tries < 6))?; + Ok(c) }