@@ -37,7 +37,7 @@ pub struct DbPoolConfig {
3737 /// packet loss between the application and the database: setting it too high will result in an
3838 /// unnecessarily long outage (before the unhealthy database logic kicks in), while setting it
3939 /// too low might result in healthy connections being dropped.
40- pub tcp_timeout_ms : u64 ,
40+ pub tcp_timeout : Duration ,
4141 /// Time to wait for a connection to become available from the connection
4242 /// pool before returning an error.
4343 pub connection_timeout : Duration ,
@@ -78,7 +78,8 @@ impl DatabasePools {
7878 let primary_min_idle = var_parsed ( "DB_PRIMARY_MIN_IDLE" ) ?;
7979 let replica_min_idle = var_parsed ( "DB_REPLICA_MIN_IDLE" ) ?;
8080
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) ;
8283
8384 let connection_timeout = var_parsed ( "DB_TIMEOUT" ) ?. unwrap_or ( 30 ) ;
8485 let connection_timeout = Duration :: from_secs ( connection_timeout) ;
@@ -102,7 +103,7 @@ impl DatabasePools {
102103 read_only_mode : true ,
103104 pool_size : primary_async_pool_size,
104105 min_idle : primary_min_idle,
105- tcp_timeout_ms ,
106+ tcp_timeout ,
106107 connection_timeout,
107108 statement_timeout,
108109 helper_threads,
@@ -117,7 +118,7 @@ impl DatabasePools {
117118 read_only_mode,
118119 pool_size : primary_async_pool_size,
119120 min_idle : primary_min_idle,
120- tcp_timeout_ms ,
121+ tcp_timeout ,
121122 connection_timeout,
122123 statement_timeout,
123124 helper_threads,
@@ -131,7 +132,7 @@ impl DatabasePools {
131132 read_only_mode,
132133 pool_size : primary_async_pool_size,
133134 min_idle : primary_min_idle,
134- tcp_timeout_ms ,
135+ tcp_timeout ,
135136 connection_timeout,
136137 statement_timeout,
137138 helper_threads,
@@ -145,7 +146,7 @@ impl DatabasePools {
145146 read_only_mode : true ,
146147 pool_size : replica_async_pool_size,
147148 min_idle : replica_min_idle,
148- tcp_timeout_ms ,
149+ tcp_timeout ,
149150 connection_timeout,
150151 statement_timeout,
151152 helper_threads,
0 commit comments