Skip to content

Commit

Permalink
add fs to deps
Browse files Browse the repository at this point in the history
  • Loading branch information
hillalex committed Sep 3, 2024
1 parent c46b094 commit 2417f12
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Imports:
base64enc,
cachem,
docopt,
fs,
jsonlite,
logger,
mgcv,
Expand All @@ -24,7 +25,6 @@ Imports:
Remotes:
hillalex/porcelain@i39,
Suggests:
fs,
lintr (>= 3.1.2),
readr,
Rook,
Expand Down
1 change: 1 addition & 0 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Options:


main <- function(args = commandArgs(TRUE)) {
options(error = rlang::entrace)
opts <- main_args(args)
port <- opts$port
logger::log_info("Starting API")
Expand Down
15 changes: 10 additions & 5 deletions R/router.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ build_routes <- function(cookie_key = plumber::random_cookie_key(),
res$setHeader("Access-Control-Allow-Credentials", "true")
}

if (!is.null(req$session$id)) {
id <- as.character(req$session$id)
cache$set(id, TRUE)
}
prune_inactive_sessions(cache)
tryCatch({
if (!is.null(req$session$id)) {
logger::log_info("Updating session cache")
id <- as.character(req$session$id)
cache$set(id, TRUE)
}
logger::log_info("Looking for inactive sessions")
prune_inactive_sessions(cache)
}, error = function(e) logger::log_error(conditionMessage(e)))

value
})

Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN install_packages --repo=https://mrc-ide.r-universe.dev \
cachem \
callr \
docopt \
fs \
logger \
jsonlite \
jsonvalidate \
Expand Down

0 comments on commit 2417f12

Please sign in to comment.