Skip to content

Commit

Permalink
fix: reset the tx depth to 0 on commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianBuzzo committed Jan 9, 2025
1 parent e43faa5 commit c454efc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion quaint/src/connector/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ impl Transaction for DefaultTransaction<'_> {
async fn commit(&self) -> crate::Result<()> {
self.inner.raw_cmd("COMMIT").await?;

self.depth.fetch_sub(1, Ordering::Relaxed);
// Reset the depth to 0 on commit
self.depth.store(0, Ordering::Relaxed);

self.gauge.decrement();

Expand Down
4 changes: 2 additions & 2 deletions query-engine/driver-adapters/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ impl QuaintTransaction for JsTransaction {

let _ = UnsafeFuture(self.tx_proxy.commit()).await;

// Modify the depth value
self.depth.fetch_sub(1, Ordering::Relaxed);
// Reset the depth to 0 on commit
self.depth.store(0, Ordering::Relaxed);

Ok(())
}
Expand Down

0 comments on commit c454efc

Please sign in to comment.