Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit 6748d9f

Browse files
committed
Add missing unload hook
1 parent 1e1f65e commit 6748d9f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

R/zzz.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#' @importFrom purrr walk
2+
#' @importFrom dbplyr remote_con
3+
#' @importFrom DBI dbDisconnect
4+
.onUnload = function(libname, pkgname){
5+
# Close connections to all cached tables. This should avoid most of the
6+
# "Connection is garbage-collected" messages
7+
cache$metadata_table |>
8+
as.list() |>
9+
purrr::walk(function(table){
10+
table |>
11+
remote_con() |>
12+
dbDisconnect()
13+
})
14+
}

0 commit comments

Comments
 (0)