Skip to content

Commit

Permalink
Update last handled block number conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurshsmith committed Sep 20, 2023
1 parent a3cddce commit ed36540
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions chaindexing/src/event_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,19 @@ impl EventHandlers {
.await;

let mut conn = conn.lock().await;
let last_handled_event_block_number = events.last().unwrap().block_number;

ChaindexingRepo::update_last_handled_block_number(
&mut conn,
contract_address.id(),
last_handled_event_block_number,
)
.await;
if let Some(Event {
block_number: last_handled_event_block_number,
..
}) = events.last()
{
ChaindexingRepo::update_last_handled_block_number(
&mut conn,
contract_address.id(),
*last_handled_event_block_number,
)
.await;
}
}
}
}

0 comments on commit ed36540

Please sign in to comment.