Skip to content

Commit

Permalink
fix(hubble): improve reorg handling - schedule sync on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
qlp committed Sep 16, 2024
1 parent 537cfaa commit 1a2075e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion hubble/src/indexer/eth/postgres.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use sqlx::{Postgres, Transaction};

use crate::indexer::api::BlockHeight;
use crate::{indexer::api::BlockHeight, postgres::schedule_replication_reset};

pub async fn delete_eth_log(
tx: &mut Transaction<'_, Postgres>,
Expand All @@ -17,5 +17,7 @@ pub async fn delete_eth_log(
.execute(tx.as_mut())
.await?;

schedule_replication_reset(tx, chain_id, height as i64, "block reorg (delete)").await?;

Ok(())
}
2 changes: 1 addition & 1 deletion hubble/src/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ where
);
let min_height = height.iter().min().expect("at least one height");

schedule_replication_reset(tx, *chain_id, (*min_height).into(), "block reorg").await?;
schedule_replication_reset(tx, *chain_id, (*min_height).into(), "block reorg (upsert)").await?;
}
}
Ok(())
Expand Down

0 comments on commit 1a2075e

Please sign in to comment.