Skip to content

Commit

Permalink
Add a debug_assert to ensure we don't try to use broken transaction m…
Browse files Browse the repository at this point in the history
…anagers
  • Loading branch information
weiznich committed Nov 26, 2024
1 parent 7c6f301 commit e857edf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/transaction_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ impl AnsiTransactionManager {
where
F: std::future::Future,
{
is_broken.store(true, Ordering::Relaxed);
let was_broken = is_broken.swap(true, Ordering::Relaxed);
debug_assert!(
!was_broken,
"Tried to execute a transaction SQL on transaction manager that was previously cancled"
);
let res = f.await;
is_broken.store(false, Ordering::Relaxed);
res
Expand Down

0 comments on commit e857edf

Please sign in to comment.