Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76f8966

Browse files
committed
move metrics
1 parent c8c9203 commit 76f8966

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

core/src/subgraph/instance_manager.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ where
543543
let metrics = ctx.block_stream_metrics.clone();
544544
let filter = ctx.state.filter.clone();
545545
let stream_inputs = inputs.clone();
546-
let mut block_stream = new_block_stream(stream_inputs, filter, metrics)
546+
let mut block_stream = new_block_stream(stream_inputs, filter, metrics.cheap_clone())
547547
.await?
548548
.map_err(CancelableError::Error)
549549
.cancelable(&block_stream_canceler, || Err(CancelableError::Cancel));
@@ -560,7 +560,13 @@ where
560560

561561
// Process events from the stream as long as no restart is needed
562562
loop {
563-
let (block, cursor) = match block_stream.next().await {
563+
let event = {
564+
let _section = metrics.stopwatch.start_section("scan_blocks");
565+
566+
block_stream.next().await
567+
};
568+
569+
let (block, cursor) = match event {
564570
Some(Ok(BlockStreamEvent::ProcessBlock(block, cursor))) => (block, cursor),
565571
Some(Ok(BlockStreamEvent::Revert(subgraph_ptr, _, optional_parent_ptr))) => {
566572
info!(

graph/src/blockchain/polling_block_stream.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ where
388388
};
389389
let to = cmp::min(from + range_size - 1, to_limit);
390390

391-
let section = ctx.metrics.stopwatch.start_section("scan_blocks");
392391
info!(
393392
ctx.logger,
394393
"Scanning blocks [{}, {}]", from, to;
@@ -397,7 +396,6 @@ where
397396

398397
let blocks = self.adapter.scan_triggers(from, to, &self.filter).await?;
399398

400-
section.end();
401399
Ok(ReconciliationStep::ProcessDescendantBlocks(
402400
blocks, range_size,
403401
))

0 commit comments

Comments
 (0)