Skip to contents

This function handles cleanup tasks when a Shiny session ends. It ensures proper resource disposal by logging the session end and closing database connections.

Usage

server_clean(session, logger, zone = "SURVEY")

Arguments

session

The Shiny session object

logger

A logger object with a log_message method for recording events

zone

Character string specifying the logging zone (default: "SURVEY")

Value

None (called for side effects)

Details

The function performs the following cleanup tasks:

  • Logs the session end event

  • Closes any open database pool connections

This function should be called within the server function of a Shiny application to ensure proper resource management.

Examples

if (FALSE) { # \dontrun{
server <- function(input, output, session) {
  # Setup logger
  logger <- LoggerFactory$new()

  # Register cleanup
  server_clean(session, logger)
}
} # }