From 596897f08ccf9f9ac8f8545a848b739065fccedb Mon Sep 17 00:00:00 2001 From: Leonardo Yvens Date: Mon, 15 Aug 2022 11:47:05 +0100 Subject: [PATCH] firehose: Set a timeout for grpc requests --- graph/src/firehose/endpoints.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graph/src/firehose/endpoints.rs b/graph/src/firehose/endpoints.rs index 3c705b2b5a7..c24c66561fb 100644 --- a/graph/src/firehose/endpoints.rs +++ b/graph/src/firehose/endpoints.rs @@ -69,7 +69,9 @@ impl FirehoseEndpoint { let endpoint = endpoint_builder .initial_connection_window_size(Some((1 << 31) - 1)) .connect_timeout(Duration::from_secs(10)) - .tcp_keepalive(Some(Duration::from_secs(15))); + .tcp_keepalive(Some(Duration::from_secs(15))) + // Timeout on each request, so the timeout to estabilish each 'Blocks' stream. + .timeout(Duration::from_secs(30)); // Load balancing on a same endpoint is useful because it creates a connection pool. let channel = Channel::balance_list(iter::repeat(endpoint).take(conn_pool_size as usize));