修复: MCP 多进程缺陷(update CAS乐观锁 + 审计落盘 + 空闲超时 + busy_timeout + stdio写回调 + list分页)
This commit is contained in:
@@ -19,6 +19,9 @@ impl Database {
|
||||
/// 打开(或创建)数据库文件
|
||||
pub async fn open(path: &Path) -> Result<Self> {
|
||||
let conn = Connection::open(path)?;
|
||||
// GUI 与 MCP server 多进程写同库(WAL 下写写仍互斥),无 busy_timeout 时并发写
|
||||
// 立即报 SQLITE_BUSY。设 5s 等待,让短暂持锁的一方先完成而非直接失败。
|
||||
conn.busy_timeout(std::time::Duration::from_millis(5000))?;
|
||||
conn.execute_batch("PRAGMA journal_mode=WAL; PRAGMA foreign_keys=ON;")?;
|
||||
|
||||
// 执行迁移
|
||||
|
||||
Reference in New Issue
Block a user