Open sebsilas opened 4 months ago
Here is a video of the behaviour:
https://github.com/rstudio/promises/assets/39628712/da4c4728-7736-43e2-80df-4e249d96a184
I believe this might only be happening when I launch the window from RStudio. Thus, a workaround is to simply turn that behaviour off using launch.browser = FALSE
.
Edit: No, I can actually reproduce this just clicking "Run App" in RStudio. The behaviour is so inconsistent.
I also see that error in some shiny-apps, when hitting F5 (reload) sometimes..
Fehler: ‘inherits(future, "Future")’ is not TRUE
Fehler: invoke_wrapped: throwing std::runtime_error
I have multiple ExtendedTask in some apps, using this structure:
data <- reactiveValues(cur = NULL, old = NULL)
get_data_async <- ExtendedTask$new(function(url, time) {
future_promise(seed=TRUE, {
library("jsonify"); library("httr");
get_data(url, time)
})
})
## Invoke Extended Task
observe({
## .. some reactives and input checks
get_data_async$invoke("someip", "tiimeconfig")
})
## Listen to Status
observe({
txt <- req(get_data_async$status())
if (txt == "running") {
} else if (txt == "error") {
warning("\nOffset-Future got rejected:\n");
print(get_data_async$result())
offsetdata$cur <- NULL
} else if (txt == "success") {
res <- get_data_async$result()
if (is.null(res)) {
data$cur <- NULL
return(NULL)
}
data$cur <- res
}
})
## Do something with the result
output$text <- renderPrint({
data$cur
})
I think putting future::plan(future::multisession)
inside the global.R
works.
I was using some delayed start of the multisession..
multisessionrv <- reactiveVal(NULL)
futuresusp <- observe(suspended = TRUE, {
library(future)
library(promises)
plan(multisession)
multisessionrv(TRUE)
})
I also randomly get this error
Will try the global.R
approach :)
Describe the bug
When I try to load a promise in the context of starting up a Shiny app, I get the following error:
Error: ‘inherits(future, "Future")’ is not TRUE
This doesn't happen consistently.
The traceback (see below) is interesting. It suggests my promise is of cluster type, even though I have used plan(multisession). If I explicitly set the plan when calling
future_promise
, I still get the same behaviour.Reproduce example
Expected behavior
I expect the promise not to fail.
Traceback
Session information