diff options
author | gennyble <gen@nyble.dev> | 2025-08-19 16:11:41 -0500 |
---|---|---|
committer | gennyble <gen@nyble.dev> | 2025-08-19 16:11:41 -0500 |
commit | 323a50d29815fc1b15bbacac69442f23f4bee156 (patch) | |
tree | a9a0662676220df4b25d98d3067ac61733a5cf43 | |
parent | a796b98cbf00af2bb9231bde4b11778edd885d41 (diff) | |
download | corgi-323a50d29815fc1b15bbacac69442f23f4bee156.tar.gz corgi-323a50d29815fc1b15bbacac69442f23f4bee156.zip |
wal mode
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | corgi/Cargo.toml | 2 | ||||
-rw-r--r-- | corgi/changelog.md | 3 | ||||
-rw-r--r-- | corgi/src/stats.rs | 16 |
4 files changed, 21 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock index eefd0c8..f3bd8c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,7 +82,7 @@ checksum = "ea618ded77af626818bde0f0802da7c20d47e38e23e37be40f6f807a76079e82" [[package]] name = "corgi" -version = "1.0.0" +version = "1.0.1" dependencies = [ "base64", "confindent", diff --git a/corgi/Cargo.toml b/corgi/Cargo.toml index f3f6bda..df2a8ef 100644 --- a/corgi/Cargo.toml +++ b/corgi/Cargo.toml @@ -6,7 +6,7 @@ license = "ISC" repository = "https://git.nyble.dev/corgi/about" readme = "../README.md" -version = "1.0.0" +version = "1.0.1" edition = "2024" [dependencies] diff --git a/corgi/changelog.md b/corgi/changelog.md new file mode 100644 index 0000000..8967e3e --- /dev/null +++ b/corgi/changelog.md @@ -0,0 +1,3 @@ +# v1.0.1 + +- have corgi set the stats database to WAL journal mode. \ No newline at end of file diff --git a/corgi/src/stats.rs b/corgi/src/stats.rs index bf9c1ec..23e85a0 100644 --- a/corgi/src/stats.rs +++ b/corgi/src/stats.rs @@ -18,10 +18,26 @@ impl Stats { pub fn create_tables(&self) { let conn = self.conn.lock().unwrap(); + + Self::set_wal(&conn); + conn.execute(CREATE_TABLE_AGENT, ()).unwrap(); conn.execute(CREATE_TABLE_REQUESTS, ()).unwrap(); } + fn set_wal(conn: &Connection) { + let journal_mode: String = conn + .pragma_update_and_check(None, "journal_mode", "WAL", |row| row.get(0)) + .unwrap(); + + match journal_mode.to_ascii_lowercase().as_str() { + "wal" => (), + _ => { + eprintln!("WARN sqlitedb did not successfully enter the WAL journal mode"); + } + } + } + pub fn log_request(&self, request: Request) { let Request { agent, |