this repo has no description

open sqlite in WAL mode

+13 -2
+13 -2
src/bin/supercell.rs
··· 1 1 use anyhow::Result; 2 - use sqlx::SqlitePool; 2 + use sqlx::{sqlite::SqliteConnectOptions, SqlitePool}; 3 3 use std::collections::HashMap; 4 4 use std::collections::HashSet; 5 + use std::str::FromStr; 5 6 use std::env; 6 7 use supercell::cache::Cache; 7 8 use supercell::cache::CacheTask; ··· 48 49 client_builder = client_builder.user_agent(config.user_agent.clone()); 49 50 let http_client = client_builder.build()?; 50 51 51 - let pool = SqlitePool::connect(&config.database_url).await?; 52 + let connect_options = SqliteConnectOptions::from_str(&config.database_url)? 53 + .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal) 54 + .create_if_missing(true) 55 + .synchronous(sqlx::sqlite::SqliteSynchronous::Normal); 56 + 57 + let pool = SqlitePool::connect_with(connect_options).await?; 52 58 sqlx::migrate!().run(&pool).await?; 53 59 54 60 let feeds: HashMap<String, (Option<String>, HashSet<String>)> = config ··· 218 224 } 219 225 220 226 tracker.wait().await; 227 + 228 + tracing::info!("closing database connection pool"); 229 + pool.close().await; 230 + 231 + tracing::info!("shutdown complete"); 221 232 222 233 Ok(()) 223 234 }