Skip to content

Commit c3daeb5

Browse files
authored
Merge pull request #191 from cmu-delphi/ds/format-cache-messages
style: use glue for line-wrapping in cache warnings
2 parents a1519eb + c839ee0 commit c3daeb5

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

R/cache.R

+8-9
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ cache_epidata_call <- function(epidata_call, fetch_args = fetch_args_list()) {
252252
if (as_of_recent || issues_recent) {
253253
cli::cli_warn(
254254
c(
255-
"using cached results with `as_of` within the past week (or the future!).",
256-
"This will likely result in an invalid cache. Consider\n",
257-
"1. disabling the cache for this session with `disable_cache` or permanently with environmental ",
258-
"variable `EPIDATR_USE_CACHE=FALSE`\n",
259-
"2. setting `EPIDATR_CACHE_MAX_AGE_DAYS={Sys.getenv('EPIDATR_CACHE_MAX_AGE_DAYS', unset = 1)}`",
260-
" to e.g. `3/24` (3 hours)."
255+
"Using cached results with `as_of` within the past week (or the future!).
256+
This will likely result in an invalid cache. Consider",
257+
"i" = "disabling the cache for this session with `disable_cache` or
258+
permanently with environmental variable `EPIDATR_USE_CACHE=FALSE`",
259+
"i" = "setting `EPIDATR_CACHE_MAX_AGE_DAYS={Sys.getenv('EPIDATR_CACHE_MAX_AGE_DAYS
260+
', unset = 1)}` to e.g. `3/24` (3 hours)."
261261
),
262262
.frequency = "regularly",
263263
.frequency_id = "cache timing issues",
@@ -267,8 +267,8 @@ cache_epidata_call <- function(epidata_call, fetch_args = fetch_args_list()) {
267267
if (!is.key_missing(cached)) {
268268
cli::cli_warn(
269269
c(
270-
"loading from the cache at {cache_environ$epidatr_cache$info()$dir}; ",
271-
"see {cache_environ$epidatr_cache$info()$logfile} for more details."
270+
"Loading from the cache at {cache_environ$epidatr_cache$info()$dir};
271+
see {cache_environ$epidatr_cache$info()$logfile} for more details."
272272
),
273273
.frequency = "regularly",
274274
.frequency_id = "using the cache",
@@ -277,7 +277,6 @@ cache_epidata_call <- function(epidata_call, fetch_args = fetch_args_list()) {
277277
return(cached[[1]])
278278
}
279279
}
280-
'which was saved on {format(cached[[2]],"%A %B %d, %Y")}, which took {round(cached[[3]][[3]], digits=5)} seconds.'
281280
# need to actually get the data, since its either not in the cache or we're not caching
282281
runtime <- system.time(if (epidata_call$only_supports_classic) {
283282
fetched <- fetch_classic(epidata_call, fetch_args)

0 commit comments

Comments
 (0)