Change MySQL Pool
Dieser Commit ist enthalten in:
Ursprung
916613773b
Commit
f567975d81
@ -16,8 +16,8 @@
|
||||
*/
|
||||
|
||||
use std::sync::Mutex;
|
||||
use sqlx::{Executor, MySql, MySqlPool, Pool, Row};
|
||||
use sqlx::mysql::MySqlConnectOptions;
|
||||
use sqlx::{ConnectOptions, Executor, MySql, MySqlPool, Pool, Row};
|
||||
use sqlx::mysql::{MySqlConnectOptions, MySqlPoolOptions};
|
||||
use crate::filter::SchematicFilter;
|
||||
|
||||
mod properties;
|
||||
@ -34,14 +34,14 @@ pub async unsafe fn get_connection() {
|
||||
let mut conn = CONN.lock().unwrap();
|
||||
if conn.is_none() {
|
||||
let properties = properties::load_mysql_properties();
|
||||
let _ = conn.insert(MySqlPool::connect_with(
|
||||
MySqlConnectOptions::new()
|
||||
let _ = conn.insert(MySqlPoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect_with(MySqlConnectOptions::new()
|
||||
.host(properties.host.as_str())
|
||||
.port(3306)
|
||||
.username(properties.user.as_str())
|
||||
.password(properties.password.as_str())
|
||||
.database(properties.database.as_str())
|
||||
)
|
||||
.database(properties.database.as_str()))
|
||||
.await.expect("Failed to connect to database"));
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren