@@ -37,7 +37,7 @@ pub struct DbPoolConfig {
37
37
/// packet loss between the application and the database: setting it too high will result in an
38
38
/// unnecessarily long outage (before the unhealthy database logic kicks in), while setting it
39
39
/// too low might result in healthy connections being dropped.
40
- pub tcp_timeout_ms : u64 ,
40
+ pub tcp_timeout : Duration ,
41
41
/// Time to wait for a connection to become available from the connection
42
42
/// pool before returning an error.
43
43
pub connection_timeout : Duration ,
@@ -78,7 +78,8 @@ impl DatabasePools {
78
78
let primary_min_idle = var_parsed ( "DB_PRIMARY_MIN_IDLE" ) ?;
79
79
let replica_min_idle = var_parsed ( "DB_REPLICA_MIN_IDLE" ) ?;
80
80
81
- let tcp_timeout_ms = var_parsed ( "DB_TCP_TIMEOUT_MS" ) ?. unwrap_or ( 15 * 1000 ) ;
81
+ let tcp_timeout = var_parsed ( "DB_TCP_TIMEOUT_MS" ) ?. unwrap_or ( 15 * 1000 ) ;
82
+ let tcp_timeout = Duration :: from_millis ( tcp_timeout) ;
82
83
83
84
let connection_timeout = var_parsed ( "DB_TIMEOUT" ) ?. unwrap_or ( 30 ) ;
84
85
let connection_timeout = Duration :: from_secs ( connection_timeout) ;
@@ -102,7 +103,7 @@ impl DatabasePools {
102
103
read_only_mode : true ,
103
104
pool_size : primary_async_pool_size,
104
105
min_idle : primary_min_idle,
105
- tcp_timeout_ms ,
106
+ tcp_timeout ,
106
107
connection_timeout,
107
108
statement_timeout,
108
109
helper_threads,
@@ -117,7 +118,7 @@ impl DatabasePools {
117
118
read_only_mode,
118
119
pool_size : primary_async_pool_size,
119
120
min_idle : primary_min_idle,
120
- tcp_timeout_ms ,
121
+ tcp_timeout ,
121
122
connection_timeout,
122
123
statement_timeout,
123
124
helper_threads,
@@ -131,7 +132,7 @@ impl DatabasePools {
131
132
read_only_mode,
132
133
pool_size : primary_async_pool_size,
133
134
min_idle : primary_min_idle,
134
- tcp_timeout_ms ,
135
+ tcp_timeout ,
135
136
connection_timeout,
136
137
statement_timeout,
137
138
helper_threads,
@@ -145,7 +146,7 @@ impl DatabasePools {
145
146
read_only_mode : true ,
146
147
pool_size : replica_async_pool_size,
147
148
min_idle : replica_min_idle,
148
- tcp_timeout_ms ,
149
+ tcp_timeout ,
149
150
connection_timeout,
150
151
statement_timeout,
151
152
helper_threads,
0 commit comments