Skip to content

Commit 1a877ae

Browse files
committed
libsql: Fix WalInsertHandle drop
As Levy pointed out, we need to make sure we don't call `wal_insert_end()` unless we're still in a WAL insertion sesion.
1 parent 7b216b5 commit 1a877ae

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libsql/src/local/connection.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,11 @@ impl WalInsertHandle<'_> {
584584

585585
impl Drop for WalInsertHandle<'_> {
586586
fn drop(&mut self) {
587-
if let Err(err) = self.conn.wal_insert_end() {
588-
tracing::error!("{:?}", err);
589-
Err(err).unwrap()
587+
if *self.in_session.borrow() {
588+
if let Err(err) = self.conn.wal_insert_end() {
589+
tracing::error!("{:?}", err);
590+
Err(err).unwrap()
591+
}
590592
}
591593
}
592594
}

0 commit comments

Comments
 (0)