Skip to content

Commit

Permalink
LANTERN-733: Changing time of execution
Browse files Browse the repository at this point in the history
  • Loading branch information
archita-ekkirala committed Sep 25, 2024
1 parent ad34780 commit 0917b20
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion shinydashboard/lantern/functions/endpoints.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ library(purrr)
# Package that makes it easier to work with dates and times for getting avg response times # nolint
library(lubridate)

timer <- reactiveTimer(1440 * 60 * 1000)
time_until_next_run <- function() {
current_time <- Sys.time()
message("current_time ", current_time)
current_hour <- as.numeric(format(current_time, "%H"))
current_minute <- as.numeric(format(current_time, "%M"))

hours_until_2am <- ifelse(current_hour >= 3, 24 - current_hour + 3, 3 - current_hour)
time_until_next_run <- (hours_until_2am * 60 * 60) - (current_minute * 60)
message("time_until_next_run: ", time_until_next_run)
return(time_until_next_run)
}

time_duration <- time_until_next_run()
timer <- reactiveTimer(time_duration * 1000)



# Get the Endpoint export table and clean up for UI
get_endpoint_export_tbl <- function(db_tables) {
Expand Down

0 comments on commit 0917b20

Please sign in to comment.