Skip to content

Commit 3a83fa9

Browse files
authored
chore(host-listener): update max message size websocket (#1410)
1 parent 45bd44f commit 3a83fa9

File tree

1 file changed

+10
-2
lines changed
  • coprocessor/fhevm-engine/host-listener/src/cmd

1 file changed

+10
-2
lines changed

coprocessor/fhevm-engine/host-listener/src/cmd/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use alloy::providers::{Provider, ProviderBuilder, WsConnect};
44
use alloy::pubsub::SubscriptionStream;
55
use alloy::rpc::types::{Block, BlockNumberOrTag, Filter, Header, Log};
66
use alloy::sol_types::SolEventInterface;
7+
use alloy::transports::ws::WebSocketConfig;
78
use anyhow::{anyhow, Result};
89
use fhevm_engine_common::telemetry;
910
use futures_util::stream::StreamExt;
@@ -187,7 +188,9 @@ impl InfiniteLogIter {
187188
}
188189

189190
async fn get_chain_id(&self) -> anyhow::Result<ChainId> {
190-
let ws = WsConnect::new(&self.url);
191+
let config = WebSocketConfig::default()
192+
.max_message_size(Some(256 * 1024 * 1024)); // 256MB
193+
let ws = WsConnect::new(&self.url).with_config(config);
191194
let provider = ProviderBuilder::new().connect_ws(ws).await?;
192195
Ok(provider.get_chain_id().await?)
193196
}
@@ -599,8 +602,13 @@ impl InfiniteLogIter {
599602

600603
async fn new_log_stream(&mut self, not_initialized: bool) {
601604
let mut retry = 20;
605+
let config = WebSocketConfig::default()
606+
.max_message_size(Some(256 * 1024 * 1024)); // 256MB
607+
602608
loop {
603-
let ws = WsConnect::new(&self.url).with_max_retries(0); // disabled, alloy skips events
609+
let ws = WsConnect::new(&self.url)
610+
.with_max_retries(0)
611+
.with_config(config); // disabled, alloy skips events
604612

605613
match ProviderBuilder::new().connect_ws(ws).await {
606614
Ok(provider) => {

0 commit comments

Comments
 (0)