Skip to content

Instantly share code, notes, and snippets.

@enxt
Created May 23, 2017 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enxt/38f7248716cfc3806cc90ccd95fde10e to your computer and use it in GitHub Desktop.
Save enxt/38f7248716cfc3806cc90ccd95fde10e to your computer and use it in GitHub Desktop.
R test future stream_in
library(future)
library(jsonlite)
basicHander <- function(jsdata) {
print(jsdata)
}
basicDisconnect <- function(a) {
cat("Deberia llamar a connect_p")
cat("....", a)
}
connect_p <- function(FUN, FUN2) {
f <- future({
stream_in(url("http://127.0.0.1:1337"), FUN, pagesize=1)
"saliendo"
}) %plan% multiprocess
while(!resolved(f)) {
Sys.sleep(2)
cat("deberia comprobar el estado del heartbeat")
}
FUN2(value(f))
"saliendo de esta conextion"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment