Skip to content

Commit

Permalink
address PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkuo committed Jul 15, 2024
1 parent f24f006 commit b7e5f0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/sui-bridge-indexer/src/sui_transaction_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub async fn handle_sui_transactions_loop(
while let Some(batch) = stream.next().await {
// unwrap: batch must not be empty
let (txns, cursor) = batch.last().cloned().unwrap();
let last_ckp = txns.last().map(|tx| tx.checkpoint).unwrap_or_default();
let token_transfers = batch
.into_iter()
// TODO: letting it panic so we can capture errors, but we should handle this more gracefully
Expand All @@ -46,6 +45,7 @@ pub async fn handle_sui_transactions_loop(

// write batched token transfers to DB
if !token_transfers.is_empty() {
let last_ckp = txns.last().map(|tx| tx.checkpoint).unwrap_or_default();
// unwrap: token_transfers is not empty
while let Err(err) = write(&pg_pool, token_transfers.clone()) {
error!("Failed to write sui transactions to DB: {:?}", err);
Expand Down

0 comments on commit b7e5f0d

Please sign in to comment.