Skip to content

Commit c46c94b

Browse files
weiznicheakoli
authored andcommitted
Add a debug_assert to ensure we don't try to use broken transaction managers
1 parent ce9d800 commit c46c94b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/transaction_manager.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ impl AnsiTransactionManager {
182182
where
183183
F: std::future::Future,
184184
{
185-
is_broken.store(true, Ordering::Relaxed);
185+
let was_broken = is_broken.swap(true, Ordering::Relaxed);
186+
debug_assert!(
187+
!was_broken,
188+
"Tried to execute a transaction SQL on transaction manager that was previously cancled"
189+
);
186190
let res = f.await;
187191
is_broken.store(false, Ordering::Relaxed);
188192
res

0 commit comments

Comments
 (0)