Added config options for setting timeouts on mysql/mariadb

This commit is contained in:
Peter Crosthwaite
2026-06-20 07:51:18 +10:00
parent 23678bf2d6
commit 348eaac81b
3 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ pub async fn run(
.arg("--skip-add-drop-table")
.arg("--compress")
.arg("--verbose")
.arg("--max-allowed-packet=512M")
.arg(format!("--max-allowed-packet={}", cfg.max_allowed_packet))
.arg("--net-buffer-length=16K")
.arg("--default-character-set=utf8mb4")
.arg(&cfg.database)
+3
View File
@@ -48,6 +48,9 @@ pub async fn run(
.arg("--skip-add-drop-table")
.arg("--no-create-db")
.arg("--default-character-set=utf8mb4")
.arg(format!("--net-read-timeout={}", cfg.net_read_timeout))
.arg(format!("--net-write-timeout={}", cfg.net_write_timeout))
.arg(format!("--max-allowed-packet={}", cfg.max_allowed_packet))
.arg(&cfg.database)
.arg("-r").arg(&file_path)
.envs(env)
+9
View File
@@ -54,6 +54,9 @@ pub struct DatabaseConfig {
pub host: String,
pub generated_id: String,
pub path: String,
pub net_read_timeout: u32,
pub net_write_timeout: u32,
pub max_allowed_packet: String,
}
#[allow(dead_code)]
@@ -75,6 +78,9 @@ pub struct InputDatabaseConfig {
pub host: Option<String>,
pub generated_id: String,
pub path: Option<String>,
pub net_read_timeout: Option<u32>,
pub net_write_timeout: Option<u32>,
pub max_allowed_packet: Option<String>,
}
#[allow(dead_code)]
@@ -224,6 +230,9 @@ impl ConfigService {
port,
generated_id: db.generated_id,
path: path_val,
net_read_timeout: db.net_read_timeout.unwrap_or(3600),
net_write_timeout: db.net_write_timeout.unwrap_or(3600),
max_allowed_packet: db.max_allowed_packet.unwrap_or_else(|| "512M".to_string()),
});
}