Parse mysql timeout.wait property as duration (closes #202)

This commit is contained in:
mdecimus
2024-01-09 11:28:52 +01:00
parent f6a9dd023a
commit 8db9a842a8

View File

@@ -21,6 +21,8 @@
* for more details. * for more details.
*/ */
use std::time::Duration;
use mysql_async::{prelude::Queryable, OptsBuilder, Pool, PoolConstraints, PoolOpts, SslOpts}; use mysql_async::{prelude::Queryable, OptsBuilder, Pool, PoolConstraints, PoolOpts, SslOpts};
use utils::config::utils::AsKey; use utils::config::utils::AsKey;
@@ -44,7 +46,11 @@ impl MysqlStore {
.to_string() .to_string()
.into(), .into(),
) )
.wait_timeout(config.property((&prefix, "timeout.wait"))?); .wait_timeout(
config
.property::<Duration>((&prefix, "timeout.wait"))?
.map(|t| t.as_secs() as usize),
);
if let Some(port) = config.property((&prefix, "port"))? { if let Some(port) = config.property((&prefix, "port"))? {
opts = opts.tcp_port(port); opts = opts.tcp_port(port);
} }