Skip to content

Commit

Permalink
Increase firehose grpc max decode size (#5483)
Browse files Browse the repository at this point in the history
  • Loading branch information
mangas committed Jun 13, 2024
1 parent de90c70 commit 1ec1bcd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion graph/src/env/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ pub struct EnvVars {
/// which must be an absolute path. This only has an effect in debug
/// builds. Set with `GRAPH_SECTION_MAP`. Defaults to `None`.
pub section_map: Option<String>,
/// Set the maximum grpc decode size(in MB) for firehose BlockIngestor connections.
/// Defaults to 25MB
pub firehose_grpc_max_decode_size_mb: usize,
}

impl EnvVars {
Expand Down Expand Up @@ -275,7 +278,7 @@ impl EnvVars {
external_http_base_url: inner.external_http_base_url,
external_ws_base_url: inner.external_ws_base_url,
static_filters_threshold: inner.static_filters_threshold,
reorg_threshold: reorg_threshold,
reorg_threshold,
ingestor_polling_interval: Duration::from_millis(inner.ingestor_polling_interval),
subgraph_settings: inner.subgraph_settings,
prefer_substreams_block_streams: inner.prefer_substreams_block_streams,
Expand All @@ -284,6 +287,7 @@ impl EnvVars {
min_history_blocks: inner.min_history_blocks.unwrap_or(2 * reorg_threshold),
dips_metrics_object_store_url: inner.dips_metrics_object_store_url,
section_map: inner.section_map,
firehose_grpc_max_decode_size_mb: inner.firehose_grpc_max_decode_size_mb,
})
}

Expand Down Expand Up @@ -425,6 +429,8 @@ struct Inner {
dips_metrics_object_store_url: Option<String>,
#[envconfig(from = "GRAPH_SECTION_MAP")]
section_map: Option<String>,
#[envconfig(from = "GRAPH_NODE_FIREHOSE_MAX_DECODE_SIZE", default = "25")]
firehose_grpc_max_decode_size_mb: usize,
}

#[derive(Clone, Debug)]
Expand Down
4 changes: 4 additions & 0 deletions graph/src/firehose/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
components::store::BlockNumber,
data::value::Word,
endpoint::{ConnectionType, EndpointMetrics, Provider, RequestLabels},
env::ENV_VARS,
firehose::decode_firehose_block,
prelude::{anyhow, debug, info, DeploymentHash},
substreams_rpc,
Expand Down Expand Up @@ -273,6 +274,9 @@ impl FirehoseEndpoint {
client = client.send_compressed(CompressionEncoding::Gzip);
}

client = client
.max_decoding_message_size(1024 * 1024 * ENV_VARS.firehose_grpc_max_decode_size_mb);

client
}

Expand Down

0 comments on commit 1ec1bcd

Please sign in to comment.