Skip to content

Commit 82aec88

Browse files
dlachaumesfauvel
authored andcommitted
Add SQL transaction to store_transactions
1 parent ca5242c commit 82aec88

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mithril-aggregator/src/database/repository/cardano_transaction_repository.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,14 @@ impl TransactionStore for CardanoTransactionRepository {
242242
}
243243

244244
async fn store_transactions(&self, transactions: Vec<CardanoTransaction>) -> StdResult<()> {
245+
self.connection.execute("BEGIN TRANSACTION;")?;
245246
// Chunk transactions to avoid an error when we exceed sqlite binding limitations
246247
for transactions_in_chunk in transactions.chunks(100) {
247248
self.create_transactions(transactions_in_chunk.to_vec())
248249
.await
249250
.with_context(|| "CardanoTransactionRepository can not store transactions")?;
250251
}
252+
self.connection.execute("END TRANSACTION;")?;
251253
Ok(())
252254
}
253255

0 commit comments

Comments
 (0)