fix: add missing idle_timeout_secs in ConnectionConfig constructors and fix clippy warnings
This commit is contained in:
1 parent
e76a223e8a
commit
2a7b26baad
11 files changed
+17
-7
No files matched your search
@@ -320,7 +320,7 @@ fn trino_agent_jdbc_params(config: &ConnectionConfig, base: &str) -> String {
|
||||
if !user_params.is_empty() {
|
||||
params.push(user_params.to_string());
|
||||
}
|
||||
if config.ssl && !url_params_has_key(&user_params, "SSL") && !url_has_query_key(base, "SSL") {
|
||||
if config.ssl && !url_params_has_key(user_params, "SSL") && !url_has_query_key(base, "SSL") {
|
||||
params.push("SSL=true".to_string());
|
||||
}
|
||||
params.join("&")
|
||||
@@ -372,7 +372,9 @@ fn append_agent_url_params(base: String, params: Option<&str>) -> String {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::models::connection::{default_connect_timeout_secs, default_query_timeout_secs};
|
||||
use crate::models::connection::{
|
||||
default_connect_timeout_secs, default_idle_timeout_secs, default_query_timeout_secs,
|
||||
};
|
||||
|
||||
fn config(db_type: DatabaseType, database: Option<&str>) -> ConnectionConfig {
|
||||
ConnectionConfig {
|
||||
@@ -393,6 +395,7 @@ mod tests {
|
||||
transport_layers: Vec::new(),
|
||||
connect_timeout_secs: default_connect_timeout_secs(),
|
||||
query_timeout_secs: default_query_timeout_secs(),
|
||||
idle_timeout_secs: default_idle_timeout_secs(),
|
||||
ssl: false,
|
||||
ca_cert_path: String::new(),
|
||||
client_cert_path: String::new(),
|
||||
|
||||
@@ -576,6 +576,7 @@ mod tests {
|
||||
})],
|
||||
connect_timeout_secs: 5,
|
||||
query_timeout_secs: 30,
|
||||
idle_timeout_secs: 60,
|
||||
ssl: false,
|
||||
ca_cert_path: String::new(),
|
||||
client_cert_path: String::new(),
|
||||
|
||||
@@ -1190,6 +1190,7 @@ mod tests {
|
||||
transport_layers: Vec::new(),
|
||||
connect_timeout_secs: default_connect_timeout_secs(),
|
||||
query_timeout_secs: crate::models::connection::default_query_timeout_secs(),
|
||||
idle_timeout_secs: crate::models::connection::default_idle_timeout_secs(),
|
||||
ssl: false,
|
||||
ca_cert_path: String::new(),
|
||||
client_cert_path: String::new(),
|
||||
|
||||
@@ -491,6 +491,7 @@ mod tests {
|
||||
transport_layers: Vec::new(),
|
||||
connect_timeout_secs: crate::models::connection::default_connect_timeout_secs(),
|
||||
query_timeout_secs: crate::models::connection::default_query_timeout_secs(),
|
||||
idle_timeout_secs: crate::models::connection::default_idle_timeout_secs(),
|
||||
ssl: false,
|
||||
ca_cert_path: String::new(),
|
||||
client_cert_path: String::new(),
|
||||
|
||||
@@ -1321,6 +1321,7 @@ mod tests {
|
||||
transport_layers: Vec::new(),
|
||||
connect_timeout_secs: super::default_connect_timeout_secs(),
|
||||
query_timeout_secs: default_query_timeout_secs(),
|
||||
idle_timeout_secs: super::default_idle_timeout_secs(),
|
||||
ssl: false,
|
||||
ca_cert_path: String::new(),
|
||||
client_cert_path: String::new(),
|
||||
|
||||
@@ -840,11 +840,8 @@ pub async fn execute_sql_statement_with_options(
|
||||
match &result {
|
||||
Err(e) if is_connection_error(e) && !is_canceled(&cancel_token) => {
|
||||
let db_opt = if database.is_empty() { None } else { Some(database) };
|
||||
let new_key = if database.is_empty() {
|
||||
state.reconnect_pool_for_session(connection_id, db_opt, options.client_session_id.as_deref()).await?
|
||||
} else {
|
||||
state.reconnect_pool_for_session(connection_id, db_opt, options.client_session_id.as_deref()).await?
|
||||
};
|
||||
let new_key =
|
||||
state.reconnect_pool_for_session(connection_id, db_opt, options.client_session_id.as_deref()).await?;
|
||||
do_execute(state, &new_key, mysql_dialect, Some(database), sql, schema, cancel_token, options).await
|
||||
}
|
||||
_ => result,
|
||||
@@ -1732,6 +1729,7 @@ mod tests {
|
||||
transport_layers: Vec::new(),
|
||||
connect_timeout_secs: 5,
|
||||
query_timeout_secs: 30,
|
||||
idle_timeout_secs: 60,
|
||||
ssl: false,
|
||||
ca_cert_path: String::new(),
|
||||
client_cert_path: String::new(),
|
||||
|
||||
@@ -638,6 +638,7 @@ mod tests {
|
||||
transport_layers: Vec::new(),
|
||||
connect_timeout_secs: 5,
|
||||
query_timeout_secs: 30,
|
||||
idle_timeout_secs: 60,
|
||||
ssl: false,
|
||||
ca_cert_path: String::new(),
|
||||
client_cert_path: String::new(),
|
||||
|
||||
@@ -3135,6 +3135,7 @@ mod tests {
|
||||
transport_layers: Vec::new(),
|
||||
connect_timeout_secs: 5,
|
||||
query_timeout_secs: 30,
|
||||
idle_timeout_secs: 60,
|
||||
ssl: false,
|
||||
ca_cert_path: String::new(),
|
||||
client_cert_path: String::new(),
|
||||
|
||||
Reference in new issue
Block a user