Skip to content

Commit

Permalink
Discard Empty Packet Batches (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedleggett authored Apr 28, 2023
1 parent 4bd7c2c commit a4ab0e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/src/proxy/block_engine_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ impl BlockEngineStage {
block_engine_stats: &mut BlockEngineStageStats,
) -> crate::proxy::Result<()> {
if let Some(batch) = resp.batch {
if batch.packets.is_empty() {
saturating_add_assign!(block_engine_stats.num_empty_packets, 1);
return Ok(());
}

let packet_batch = PacketBatch::new(
batch
.packets
Expand Down
5 changes: 5 additions & 0 deletions core/src/proxy/relayer_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ impl RelayerStage {
saturating_add_assign!(relayer_stats.num_empty_messages, 1);
}
Some(relayer::subscribe_packets_response::Msg::Batch(proto_batch)) => {
if proto_batch.packets.is_empty() {
saturating_add_assign!(relayer_stats.num_empty_messages, 1);
return Ok(());
}

let packet_batch = PacketBatch::new(
proto_batch
.packets
Expand Down

0 comments on commit a4ab0e2

Please sign in to comment.