refactor(hive-c0re): shared sqlite open helper with busy timeout
one db::open owns the parent-dir + connection + busy_timeout dance for every host-side store (broker/approvals/questions/schedules/power in broker.sqlite, build_logs, audit_log); schema + migrations stay per store. same-file connections now wait out concurrent writers instead of risking SQLITE_BUSY.
This commit is contained in:
parent
604e1c2557
commit
380c6ad47f
8 changed files with 45 additions and 41 deletions
|
|
@ -147,11 +147,8 @@ pub struct BuildLogs {
|
|||
|
||||
impl BuildLogs {
|
||||
pub fn open(db_dir: &Path) -> Result<Self> {
|
||||
std::fs::create_dir_all(db_dir)
|
||||
.with_context(|| format!("create build_logs db parent {}", db_dir.display()))?;
|
||||
let path = db_dir.join("build_logs.sqlite");
|
||||
let conn = Connection::open(&path)
|
||||
.with_context(|| format!("open build_logs db {}", path.display()))?;
|
||||
let conn = crate::db::open(&path, "build_logs")?;
|
||||
conn.execute_batch(SCHEMA)
|
||||
.context("apply build_logs schema")?;
|
||||
let (notify_tx, _) = broadcast::channel(NOTIFY_CAP);
|
||||
|
|
|
|||
Loading…
Reference in a new issue