Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3519603
D10329.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
987 B
Referenced Files
None
Subscribers
None
D10329.diff
View Options
diff --git a/shared/grpc_clients/src/lib.rs b/shared/grpc_clients/src/lib.rs
--- a/shared/grpc_clients/src/lib.rs
+++ b/shared/grpc_clients/src/lib.rs
@@ -7,6 +7,7 @@
use error::Error;
use std::path::Path;
+use std::time::Duration;
use tonic::transport::{Certificate, Channel, ClientTlsConfig};
use tracing::info;
@@ -17,6 +18,7 @@
"/etc/ssl/certs/ca-bundle.crt",
"/etc/ssl/certs/ca-certificates.crt",
];
+const CONNECT_TIMEOUT_DURATION: Duration = Duration::from_secs(5);
pub(crate) fn get_ca_cert_contents() -> Option<String> {
CERT_PATHS
@@ -32,7 +34,8 @@
let ca_cert = crate::get_ca_cert_contents().expect("Unable to get CA bundle");
info!("Connecting to gRPC service at {}", url);
- let mut channel = Channel::from_shared(url.to_string())?;
+ let mut channel = Channel::from_shared(url.to_string())?
+ .connect_timeout(CONNECT_TIMEOUT_DURATION);
// tls_config will fail if the underlying URI is only http://
if url.starts_with("https:") {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 10:43 PM (13 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2696930
Default Alt Text
D10329.diff (987 B)
Attached To
Mode
D10329: [grpc_clients] add connect_timeout to shared grpc client
Attached
Detach File
Event Timeline
Log In to Comment