From f86b73aa979e50fc5510720763611e16fe50a715 Mon Sep 17 00:00:00 2001 From: dylanbenzi Date: Tue, 10 Jun 2025 16:04:05 -0400 Subject: [PATCH] add mirai setup --- dashboard.Rmd | 20 ++++++++++++++++++++ queries.R | 10 +++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/dashboard.Rmd b/dashboard.Rmd index c027b0b..cafb9da 100644 --- a/dashboard.Rmd +++ b/dashboard.Rmd @@ -40,6 +40,9 @@ library(tigris) library(caret) library(scales) library(billboarder) +library(mirai) + +daemons(3) linuxdir <- "/home/dylan/Personal/Projects/Hurricane Normalization/" macdir <- "~/Desktop/Personal/Projects/Hurricane Normalization/" @@ -95,8 +98,25 @@ storm_selection <- reactiveValues( is_table_selection = FALSE, ) +async_reqs <- reactiveValues( + hurdat_track = NULL, +) + +loading_states <- reactiveValues( + hurdat_track = FALSE, + track_error = NULL, +) + onStop(function() { dbDisconnect(con) + + if(!is.null(async_reqs$track_request)) { + tryCatch({ + async_reqs$track_request <- NULL + }, error = function(e) { + cat(e) + }) + } }) ``` diff --git a/queries.R b/queries.R index 78d1a23..ee5e70c 100644 --- a/queries.R +++ b/queries.R @@ -3,7 +3,6 @@ library(tidyverse) library(dplyr) library(DBI) -#library(sf) linuxdir <- "/home/dylan/Personal/Projects/Hurricane Normalization/" macdir <- "~/Desktop/Personal/Projects/Hurricane Normalization/" @@ -217,6 +216,15 @@ get_hurdat_landfalls <- function(storm) { result <- query %>% collect() + #return( + # list( + # data = result, + # storm_info = storm, + # row_count = nrow(result), + # timestamp = Sys.time() + # ) + #) + return(result) }