@@ -1161,6 +1161,7 @@ where
11611161 & mut self ,
11621162 event : Option < Result < BlockStreamEvent < C > , CancelableError < BlockStreamError > > > ,
11631163 ) -> Result < Action , Error > {
1164+ let stopwatch = & self . metrics . stream . stopwatch ;
11641165 let action = match event {
11651166 Some ( Ok ( BlockStreamEvent :: ProcessWasmBlock (
11661167 block_ptr,
@@ -1169,31 +1170,19 @@ where
11691170 handler,
11701171 cursor,
11711172 ) ) ) => {
1172- let _section = self
1173- . metrics
1174- . stream
1175- . stopwatch
1176- . start_section ( PROCESS_WASM_BLOCK_SECTION_NAME ) ;
1173+ let _section = stopwatch. start_section ( PROCESS_WASM_BLOCK_SECTION_NAME ) ;
11771174 let res = self
11781175 . handle_process_wasm_block ( block_ptr. clone ( ) , block_time, data, handler, cursor)
11791176 . await ;
11801177 let start = Instant :: now ( ) ;
11811178 self . handle_action ( start, block_ptr, res) . await ?
11821179 }
11831180 Some ( Ok ( BlockStreamEvent :: ProcessBlock ( block, cursor) ) ) => {
1184- let _section = self
1185- . metrics
1186- . stream
1187- . stopwatch
1188- . start_section ( PROCESS_BLOCK_SECTION_NAME ) ;
1181+ let _section = stopwatch. start_section ( PROCESS_BLOCK_SECTION_NAME ) ;
11891182 self . handle_process_block ( block, cursor) . await ?
11901183 }
11911184 Some ( Ok ( BlockStreamEvent :: Revert ( revert_to_ptr, cursor) ) ) => {
1192- let _section = self
1193- . metrics
1194- . stream
1195- . stopwatch
1196- . start_section ( HANDLE_REVERT_SECTION_NAME ) ;
1185+ let _section = stopwatch. start_section ( HANDLE_REVERT_SECTION_NAME ) ;
11971186 self . handle_revert ( revert_to_ptr, cursor) . await ?
11981187 }
11991188 // Log and drop the errors from the block_stream
0 commit comments