File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ pub mod openai;
69
69
70
70
const DEFAULT_CONNECT_TIMEOUT_SEC : u64 = 60 ;
71
71
const DEFAULT_REQUEST_TIMEOUT_SEC : u64 = 600 ;
72
+ const DEFAULT_GRPC_PROBE_INTERVAL_SEC : u64 = 10 ;
72
73
73
74
pub type BoxStream < T > = Pin < Box < dyn Stream < Item = T > + Send > > ;
74
75
@@ -270,13 +271,19 @@ pub async fn create_grpc_client<C: Debug + Clone>(
270
271
let mut base_url = Url :: parse ( & format ! ( "{}://{}" , protocol, & service_config. hostname) ) . unwrap ( ) ;
271
272
base_url. set_port ( Some ( port) ) . unwrap ( ) ;
272
273
debug ! ( %base_url, "creating gRPC client" ) ;
273
- let connect_timeout = Duration :: from_secs ( DEFAULT_REQUEST_TIMEOUT_SEC ) ;
274
+ let connect_timeout = Duration :: from_secs ( DEFAULT_CONNECT_TIMEOUT_SEC ) ;
274
275
let request_timeout = Duration :: from_secs (
275
276
service_config
276
277
. request_timeout
277
278
. unwrap_or ( DEFAULT_REQUEST_TIMEOUT_SEC ) ,
278
279
) ;
280
+ let grpc_dns_probe_interval = Duration :: from_secs (
281
+ service_config
282
+ . grpc_dns_probe_interval
283
+ . unwrap_or ( DEFAULT_GRPC_PROBE_INTERVAL_SEC ) ,
284
+ ) ;
279
285
let mut builder = LoadBalancedChannel :: builder ( ( service_config. hostname . clone ( ) , port) )
286
+ . dns_probe_interval ( grpc_dns_probe_interval)
280
287
. connect_timeout ( connect_timeout)
281
288
. timeout ( request_timeout) ;
282
289
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ pub struct ServiceConfig {
65
65
pub request_timeout : Option < u64 > ,
66
66
/// TLS provider info
67
67
pub tls : Option < Tls > ,
68
+ /// gRPC probe interval in seconds
69
+ pub grpc_dns_probe_interval : Option < u64 > ,
68
70
}
69
71
70
72
impl ServiceConfig {
@@ -74,6 +76,7 @@ impl ServiceConfig {
74
76
port : Some ( port) ,
75
77
request_timeout : None ,
76
78
tls : None ,
79
+ grpc_dns_probe_interval : None ,
77
80
}
78
81
}
79
82
}
You can’t perform that action at this time.
0 commit comments