Skip to content

Commit

Permalink
Merge pull request #101 from chaindexing/fix-ingester-restart
Browse files Browse the repository at this point in the history
Restart Ingesting from start_block_number instead of zero
  • Loading branch information
Jurshsmith committed Apr 18, 2024
2 parents 74640a4 + d6ffca8 commit a399498
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions chaindexing/src/repos/postgres_repo/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ impl RepoMigrations for PostgresRepo {
fn create_contract_addresses_migration() -> &'static [&'static str] {
SQLikeMigrations::create_contract_addresses()
}
fn zero_ingest_and_handlers_next_block_numbers_migration() -> &'static [&'static str] {
SQLikeMigrations::zero_ingest_and_handlers_next_block_numbers()
fn restart_ingest_and_handlers_next_block_numbers_migration() -> &'static [&'static str] {
SQLikeMigrations::restart_ingest_and_handlers_next_block_numbers()
}
fn zero_next_block_number_for_side_effects_migration() -> &'static [&'static str] {
SQLikeMigrations::zero_next_block_number_for_side_effects()
Expand Down
8 changes: 4 additions & 4 deletions chaindexing/src/repos/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub trait RepoMigrations: Migratable {
fn create_nodes_migration() -> &'static [&'static str];

fn create_contract_addresses_migration() -> &'static [&'static str];
fn zero_ingest_and_handlers_next_block_numbers_migration() -> &'static [&'static str];
fn restart_ingest_and_handlers_next_block_numbers_migration() -> &'static [&'static str];
fn zero_next_block_number_for_side_effects_migration() -> &'static [&'static str];

fn create_events_migration() -> &'static [&'static str];
Expand All @@ -189,7 +189,7 @@ pub trait RepoMigrations: Migratable {
[
Self::drop_events_migration(),
Self::drop_reorged_blocks_migration(),
Self::zero_ingest_and_handlers_next_block_numbers_migration(),
Self::restart_ingest_and_handlers_next_block_numbers_migration(),
]
.concat()
}
Expand Down Expand Up @@ -242,9 +242,9 @@ impl SQLikeMigrations {
ON chaindexing_contract_addresses(chain_id, address)",
]
}
pub fn zero_ingest_and_handlers_next_block_numbers() -> &'static [&'static str] {
pub fn restart_ingest_and_handlers_next_block_numbers() -> &'static [&'static str] {
&["UPDATE chaindexing_contract_addresses
SET next_block_number_to_handle_from = 0, next_block_number_to_ingest_from = 0"]
SET next_block_number_to_handle_from = start_block_number, next_block_number_to_ingest_from = start_block_number"]
}
pub fn zero_next_block_number_for_side_effects() -> &'static [&'static str] {
&["UPDATE chaindexing_contract_addresses SET next_block_number_for_side_effects = 0"]
Expand Down

0 comments on commit a399498

Please sign in to comment.