1+ use std:: time:: Duration ;
2+
13use schemars:: JsonSchema ;
24use serde:: { Deserialize , Serialize } ;
35
@@ -9,8 +11,13 @@ pub struct TrafficShapingConfig {
911 pub max_connections_per_host : usize ,
1012
1113 /// Timeout for idle sockets being kept-alive.
12- #[ serde( default = "default_pool_idle_timeout_seconds" ) ]
13- pub pool_idle_timeout_seconds : u64 ,
14+ #[ serde(
15+ default = "default_pool_idle_timeout" ,
16+ deserialize_with = "humantime_serde::deserialize" ,
17+ serialize_with = "humantime_serde::serialize"
18+ ) ]
19+ #[ schemars( with = "String" ) ]
20+ pub pool_idle_timeout : Duration ,
1421
1522 /// Enables/disables request deduplication to subgraphs.
1623 ///
@@ -24,7 +31,7 @@ impl Default for TrafficShapingConfig {
2431 fn default ( ) -> Self {
2532 Self {
2633 max_connections_per_host : default_max_connections_per_host ( ) ,
27- pool_idle_timeout_seconds : default_pool_idle_timeout_seconds ( ) ,
34+ pool_idle_timeout : default_pool_idle_timeout ( ) ,
2835 dedupe_enabled : default_dedupe_enabled ( ) ,
2936 }
3037 }
@@ -34,8 +41,8 @@ fn default_max_connections_per_host() -> usize {
3441 100
3542}
3643
37- fn default_pool_idle_timeout_seconds ( ) -> u64 {
38- 50
44+ fn default_pool_idle_timeout ( ) -> Duration {
45+ Duration :: from_secs ( 50 )
3946}
4047
4148fn default_dedupe_enabled ( ) -> bool {
0 commit comments