tangled
alpha
login
or
join now
edavis.dev
/
supercell
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
open sqlite in WAL mode
Eric Davis
2 months ago
bc7f33c2
663c04cd
+13
-2
1 changed file
expand all
collapse all
unified
split
src
bin
supercell.rs
+13
-2
src/bin/supercell.rs
···
1
1
use anyhow::Result;
2
2
-
use sqlx::SqlitePool;
2
2
+
use sqlx::{sqlite::SqliteConnectOptions, SqlitePool};
3
3
use std::collections::HashMap;
4
4
use std::collections::HashSet;
5
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
51
-
let pool = SqlitePool::connect(&config.database_url).await?;
52
52
+
let connect_options = SqliteConnectOptions::from_str(&config.database_url)?
53
53
+
.journal_mode(sqlx::sqlite::SqliteJournalMode::Wal)
54
54
+
.create_if_missing(true)
55
55
+
.synchronous(sqlx::sqlite::SqliteSynchronous::Normal);
56
56
+
57
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
227
+
228
228
+
tracing::info!("closing database connection pool");
229
229
+
pool.close().await;
230
230
+
231
231
+
tracing::info!("shutdown complete");
221
232
222
233
Ok(())
223
234
}