Created
May 23, 2017 12:43
-
-
Save enxt/38f7248716cfc3806cc90ccd95fde10e to your computer and use it in GitHub Desktop.
R test future stream_in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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