diff --git a/R/pool-methods.R b/R/pool-methods.R index bc88c22..bcc34a5 100644 --- a/R/pool-methods.R +++ b/R/pool-methods.R @@ -6,6 +6,11 @@ #' little computational cost. The pool should be created only once #' and closed when it is no longer needed, to prevent leaks. #' +#' Every usage of `poolCreate()` should always be paired with a call to +#' `poolClose()` to avoid "leaking" resources. In shiny app, you should +#' create the pool outside of the server function and close it on stop, +#' i.e. `onStop(function() pool::poolClose(pool))`. +#' #' See [dbPool()] for an example of object pooling applied to DBI database #' connections. #' diff --git a/man/Pool-class.Rd b/man/Pool-class.Rd index 5899c02..4eddda7 100644 --- a/man/Pool-class.Rd +++ b/man/Pool-class.Rd @@ -49,6 +49,11 @@ from the pool and released back to it at will, with very little computational cost. The pool should be created only once and closed when it is no longer needed, to prevent leaks. +Every usage of \code{poolCreate()} should always be paired with a call to +\code{poolClose()} to avoid "leaking" resources. In shiny app, you should +create the pool outside of the server function and close it on stop, +i.e. \code{onStop(function() pool::poolClose(pool))}. + See \code{\link[=dbPool]{dbPool()}} for an example of object pooling applied to DBI database connections. }