Skip to content

Commit

Permalink
core: call revert_state_to to last good block BlockProcessingError
Browse files Browse the repository at this point in the history
  • Loading branch information
incrypto32 committed Feb 8, 2024
1 parent a31261f commit f142fcc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/subgraph/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,13 @@ where
// Handle unexpected stream errors by marking the subgraph as failed.
Err(e) => {
self.metrics.stream.deployment_failed.set(1.0);
let last_good_block = self
.inputs
.store
.block_ptr()
.map(|ptr| ptr.number)
.unwrap_or(0);
self.revert_state_to(last_good_block)?;

let message = format!("{:#}", e).replace('\n', "\t");
let err = anyhow!("{}, code: {}", message, LogCode::SubgraphSyncingFailure);
Expand Down

0 comments on commit f142fcc

Please sign in to comment.