Set SqlxSqlit pool max connection to 1
This commit is contained in:
parent
9bd537efe3
commit
a1a7a98a5c
@ -1,5 +1,5 @@
|
|||||||
use sqlx::{
|
use sqlx::{
|
||||||
sqlite::{SqliteArguments, SqliteQueryResult, SqliteRow},
|
sqlite::{SqliteArguments, SqlitePoolOptions, SqliteQueryResult, SqliteRow},
|
||||||
Sqlite, SqlitePool,
|
Sqlite, SqlitePool,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -24,7 +24,11 @@ impl SqlxSqliteConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
pub async fn connect(string: &str) -> Result<DatabaseConnection, DbErr> {
|
||||||
if let Ok(pool) = SqlitePool::connect(string).await {
|
if let Ok(pool) = SqlitePoolOptions::new()
|
||||||
|
.max_connections(1)
|
||||||
|
.connect(string)
|
||||||
|
.await
|
||||||
|
{
|
||||||
Ok(DatabaseConnection::SqlxSqlitePoolConnection(
|
Ok(DatabaseConnection::SqlxSqlitePoolConnection(
|
||||||
SqlxSqlitePoolConnection { pool },
|
SqlxSqlitePoolConnection { pool },
|
||||||
))
|
))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user