From c4e11f05b602daffd1db46296825ee3c39153558 Mon Sep 17 00:00:00 2001 From: Nulo Date: Wed, 3 Jul 2024 23:36:00 -0300 Subject: [PATCH] probar cambiando pragmas --- rust/src/api/main.rs | 4 +++- rust/src/scraper/db.rs | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/rust/src/api/main.rs b/rust/src/api/main.rs index cb22af3..5dc05cd 100644 --- a/rust/src/api/main.rs +++ b/rust/src/api/main.rs @@ -107,9 +107,11 @@ async fn main() { )) .unwrap() .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal) + .pragma("journal_size_limit", "67108864") + .pragma("mmap_size", "134217728") .synchronous(sqlx::sqlite::SqliteSynchronous::Normal) .busy_timeout(Duration::from_secs(15)) - .pragma("cache_size", "1000000000") + .pragma("cache_size", "2000") .optimize_on_close(true, None), ) .await diff --git a/rust/src/scraper/db.rs b/rust/src/scraper/db.rs index ff54e91..ce78efa 100644 --- a/rust/src/scraper/db.rs +++ b/rust/src/scraper/db.rs @@ -22,10 +22,13 @@ impl Db { .max_connections(1) .connect_with( SqliteConnectOptions::from_str(&format!("sqlite://{}", db_path))? + // https://fractaledmind.github.io/2023/09/07/enhancing-rails-sqlite-fine-tuning/ .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal) + .pragma("journal_size_limit", "67108864") + .pragma("mmap_size", "134217728") .synchronous(sqlx::sqlite::SqliteSynchronous::Normal) .busy_timeout(Duration::from_secs(15)) - .pragma("cache_size", "1000000000") + .pragma("cache_size", "2000") .pragma("temp_store", "memory") .optimize_on_close(true, None), )