mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
Centralize SQLite connection configuration (#33938)
## What changed - Add `SqliteConfig` as the shared entry point for read-write and read-only SQLite pools. - Apply consistent WAL, synchronization, auto-vacuum, busy-timeout, logging, and pool-size settings to writable Codex databases. - Route state runtime, audit, CLI, and test database connections through the shared configuration. ## Testing - Run migration tests against temporary on-disk databases opened through `SqliteConfig`, including the concurrent-writer repair case. GitOrigin-RevId: e3946b98bde04c47574532ac8b1a7bb2b03edd97
This commit is contained in:
committed by
copyberry
parent
23899f7cb6
commit
6bd3f5e3db
@@ -727,8 +727,6 @@ mod tests {
|
||||
use super::*;
|
||||
use codex_protocol::ThreadId;
|
||||
use pretty_assertions::assert_eq;
|
||||
use sqlx::sqlite::SqliteConnectOptions;
|
||||
use sqlx::sqlite::SqlitePoolOptions;
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[tokio::test]
|
||||
@@ -1152,14 +1150,11 @@ mod tests {
|
||||
|
||||
async fn insert_thread_row(&self, id: &str, rollout_path: &Path, archived: bool) {
|
||||
let state_db_path = codex_state::state_db_path(self.sqlite_home.path());
|
||||
let options = SqliteConnectOptions::new()
|
||||
.filename(state_db_path)
|
||||
.create_if_missing(false);
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.max_connections(1)
|
||||
.connect_with(options)
|
||||
.await
|
||||
.expect("sqlite pool");
|
||||
let pool =
|
||||
codex_state::SqliteConfig::new_for_testing(self.sqlite_home.path().to_path_buf())
|
||||
.open_read_write_pool(&state_db_path)
|
||||
.await
|
||||
.expect("sqlite pool");
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT INTO threads (
|
||||
|
||||
Reference in New Issue
Block a user