Skip to content

Commit

Permalink
fix: commit AtomicOperation without events
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Jun 7, 2024
1 parent d55c647 commit 7efeaf2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cala-ledger/src/atomic_operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ impl<'a> AtomicOperation<'a> {
}

pub async fn commit(self) -> Result<(), sqlx::Error> {
self.outbox
.persist_events(self.tx, self.accumulated_events)
.await?;
if self.accumulated_events.is_empty() {
self.tx.commit().await?;
} else {
self.outbox
.persist_events(self.tx, self.accumulated_events)
.await?;
}
Ok(())
}
}

0 comments on commit 7efeaf2

Please sign in to comment.