Skip to content

Commit

Permalink
Make sure we use uncached data
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Nov 14, 2024
1 parent ee0cace commit 5948b8c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ setup_universes <- function(){
}

# Check for app installations that can be removed (no published packages)
stats <- jsonlite::stream_in(url('https://r-universe.dev/stats/universes'), verbose = FALSE)
stats <- runiverse_stream_in('/stats/universes')
oldies <- subset(installs, days > 10)
empties <- setdiff(oldies$name, c(skiplist, stats$universe))
cat("Found empty universes: ", paste(empties, collapse = ", "), "\n")
Expand Down Expand Up @@ -75,7 +75,7 @@ setup_universes <- function(){
#' @export
delete_orphans <- function(){
universes <- list_universes()
files <- jsonlite::stream_in(url('https://r-universe.dev/stats/files'))
files <- runiverse_stream_in('/stats/files')
files$orphan <- is.na(match(files$user, universes))
deleted <- subset(files, orphan & !duplicated(paste0(files$user, '/', files$package)))
for(i in seq_len(nrow(deleted))){
Expand Down Expand Up @@ -161,3 +161,9 @@ parse_res <- function(res){
stop(text)
jsonlite::fromJSON(text)
}

runiverse_stream_in <- function(path){
urlstr <- sprintf('https://r-universe.dev%s?nocache=%f', path, rnorm(1))
message("Getting ", urlstr)
jsonlite::stream_in(url(urlstr), verbose = interactive())
}

0 comments on commit 5948b8c

Please sign in to comment.