Skip to content

Commit

Permalink
Relax ordering mode of TransactionProxy::closed modifications
Browse files Browse the repository at this point in the history
There's no need in release-store in commit/rollback and acquire-load in
destructor anymore since we don't care for commit to have finished in
the destructor anymore.
  • Loading branch information
aqrln committed Nov 24, 2023
1 parent 3948956 commit 96e9ec8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions query-engine/driver-adapters/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ impl TransactionProxy {
/// will not attempt rolling the transaction back even if the `commit` future was dropped while
/// waiting on the JavaScript call to complete and deliver response.
pub async fn commit(&self) -> quaint::Result<()> {
self.closed.store(true, Ordering::Release);
self.closed.store(true, Ordering::Relaxed);
self.commit.call(()).await
}

Expand All @@ -630,14 +630,14 @@ impl TransactionProxy {
/// will not attempt rolling back again even if the `rollback` future was dropped while waiting
/// on the JavaScript call to complete and deliver response.
pub async fn rollback(&self) -> quaint::Result<()> {
self.closed.store(true, Ordering::Release);
self.closed.store(true, Ordering::Relaxed);
self.rollback.call(()).await
}
}

impl Drop for TransactionProxy {
fn drop(&mut self) {
if self.closed.swap(true, Ordering::Acquire) {
if self.closed.swap(true, Ordering::Relaxed) {
return;
}

Expand Down

0 comments on commit 96e9ec8

Please sign in to comment.