this repo has no description

open sqlite in WAL mode

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