Skip to content

Commit

Permalink
Handle failed inserts
Browse files Browse the repository at this point in the history
  • Loading branch information
vrtnd committed Jun 29, 2023
1 parent 85d82bb commit d987199
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions src/utils/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,25 +497,31 @@ export const runAdapterHistorical = async (
to.toLowerCase() === "0x0000000000000000000000000000000000000000"
)
return;
await insertTransactionRow(
sql,
allowNullTxValues,
{
bridge_id: bridgeIdOverride,
chain: chainContractsAreOn,
tx_hash: txHash ?? null,
ts: timestamp,
tx_block: blockNumber ?? null,
tx_from: from ?? null,
tx_to: to ?? null,
token: token,
amount: amountString,
is_deposit: isDeposit,
is_usd_volume: isUSDVolume ?? false,
txs_counted_as: txsCountedAs ?? 0,
},
onConflict
);

try {
await insertTransactionRow(
sql,
allowNullTxValues,
{
bridge_id: bridgeIdOverride,
chain: chainContractsAreOn,
tx_hash: txHash ?? null,
ts: timestamp,
tx_block: blockNumber ?? null,
tx_from: from ?? null,
tx_to: to ?? null,
token: token,
amount: amountString,
is_deposit: isDeposit,
is_usd_volume: isUSDVolume ?? false,
txs_counted_as: txsCountedAs ?? 0,
},
onConflict
);
} catch (e: any) {
console.error("Error: Insert failed" + e?.message);
continue;
}
}
});
console.log("finished inserting transactions");
Expand Down

0 comments on commit d987199

Please sign in to comment.