1
0
Mirror von https://github.com/Chaoscaot/schemsearch synchronisiert 2024-11-20 02:40:08 +01:00

Change MySQL Pool

Dieser Commit ist enthalten in:
Chaoscaot 2023-03-12 14:24:40 +01:00
Ursprung 916613773b
Commit f567975d81

Datei anzeigen

@ -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"));
}
}