refactor(router): set sensible RPC timeouts
Copies these over from the client_util package.
@@ -14,6 +14,8 @@ use tonic::transport::{Channel, Endpoint};
use super::{client::WriteClient, RpcWriteError};
const RETRY_INTERVAL: Duration = Duration::from_secs(1);
+const CONNECT_TIMEOUT: Duration = Duration::from_secs(1);
+const REQUEST_TIMEOUT: Duration = Duration::from_secs(30);
/// Lazy [`Channel`] connector.
///
@@ -33,6 +35,9 @@ pub struct LazyConnector {
impl LazyConnector {
/// Lazily connect to `addr`.
pub fn new(addr: Endpoint) -> Self {
+ let addr = addr
+ .connect_timeout(CONNECT_TIMEOUT)
+ .timeout(REQUEST_TIMEOUT);
let connection = Default::default();
Self {
addr: addr.clone(),
