summaryrefslogtreecommitdiff
path: root/src/database.rs
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-03-28 21:40:33 +0800
committerKeuin <[email protected]>2022-03-28 21:40:33 +0800
commit026f5839e2359d565229c05b768f8a7ed694bf4b (patch)
tree2495fe6397e5f1ff81eeee37b844387f1be45d4c /src/database.rs
parent2d3f83cb7f78706c1ba5af966afc5625037ab5ce (diff)
Make `sqlite_thread_pool_size` configurable.
Diffstat (limited to 'src/database.rs')
-rw-r--r--src/database.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/database.rs b/src/database.rs
index a73aafd..07830a6 100644
--- a/src/database.rs
+++ b/src/database.rs
@@ -9,15 +9,13 @@ use crate::user::User;
pub type DbPool = sqlx::sqlite::SqlitePool;
-const SQLITE_THREAD_POOL_SIZE: u32 = 16;
-
-pub async fn open(file_path: &str) -> Result<DbPool, sqlx::Error> {
+pub async fn open(file_path: &str, sqlite_thread_pool_size: u32) -> Result<DbPool, sqlx::Error> {
let opt =
SqliteConnectOptions::from_str(format!("sqlite://{}", file_path).as_str())?
.create_if_missing(true);
debug!("Opening database pool...");
let pool = SqlitePoolOptions::new()
- .max_connections(SQLITE_THREAD_POOL_SIZE)
+ .max_connections(sqlite_thread_pool_size)
.connect_with(opt).await?;
// create table