Skip to content

Commit e48ec89

Browse files
committed
doc: add comment explaining implicit transaction commit on drop
1 parent 77cd2ab commit e48ec89

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/transaction.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ impl Drop for Transaction<'_> {
166166
// Given that the default behavior in JavaScript is to commit the
167167
// transaction when it is dropped, we only need to perform an action
168168
// when we want to abort the transaction.
169+
//
170+
// Typically, it would make sense to explicitly commit the transaction
171+
// with `TransactionSys::do_commit` when encountering `OnTransactionDrop::Commit`.
172+
// However, for some reason, explicitly committing the transaction causes
173+
// tests in a headless Chrome browser to hang, even though they pass in
174+
// all other contexts, including a non-headless Chrome browser. So, until
175+
// this is resolved, it is best to let `OnTransactionDrop::Commit` be
176+
// handled implicitly by the JavaScript runtime.
169177
if !self.done & matches!(self.on_drop, OnTransactionDrop::Abort) {
170178
let _ = self.as_sys().abort();
171179
}

0 commit comments

Comments
 (0)