Skip to content

Commit 4de77f6

Browse files
committed
just run close() on Connection::Drop
1 parent 8d2c23a commit 4de77f6

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

core/lib.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,22 +1190,8 @@ unsafe impl Sync for Connection {}
11901190

11911191
impl Drop for Connection {
11921192
fn drop(&mut self) {
1193-
if !self.is_closed() {
1194-
// if connection wasn't properly closed, decrement the connection counter
1195-
if self
1196-
.db
1197-
.n_connections
1198-
.fetch_sub(1, std::sync::atomic::Ordering::SeqCst)
1199-
.eq(&1)
1200-
{
1201-
if let Err(e) = self
1202-
.pager
1203-
.load()
1204-
.checkpoint_shutdown(self.is_wal_auto_checkpoint_disabled())
1205-
{
1206-
tracing::error!("Error during WAL checkpoint on connection drop: {}", e);
1207-
}
1208-
}
1193+
if let Err(e) = self.close() {
1194+
tracing::error!("Error closing connection: {}", e);
12091195
}
12101196
}
12111197
}

0 commit comments

Comments
 (0)