diff --git a/R/daemon.R b/R/daemon.R index d9330796e..57931aaf9 100644 --- a/R/daemon.R +++ b/R/daemon.R @@ -214,4 +214,3 @@ perform_cleanup <- function(cleanup) { } snapshot <- function() `[[<-`(`[[<-`(`[[<-`(., "op", .Options), "se", search()), "vars", names(.GlobalEnv)) - diff --git a/R/dispatcher.R b/R/dispatcher.R index b56e6b95f..975dd9cfc 100644 --- a/R/dispatcher.R +++ b/R/dispatcher.R @@ -101,7 +101,7 @@ dispatcher <- function(host, url = NULL, n = NULL, ..., asyncdial = FALSE, } envir <- new.env(hash = FALSE) - if (length(rs)) `[[<-`(envir, "stream", as.integer(rs)) + if (is.numeric(rs)) `[[<-`(envir, "stream", as.integer(rs)) for (i in seq_n) { burl <- if (auto) .urlscheme else diff --git a/R/parallel.R b/R/parallel.R index a59e9fc5c..34d5d2248 100644 --- a/R/parallel.R +++ b/R/parallel.R @@ -97,11 +97,11 @@ make_cluster <- function(n, url = NULL, remote = NULL, ...) { id <- sprintf("`%d`", length(..)) + cv2 <- cv() if (is.character(url)) { length(url) == 1L || stop(._[["single_url"]]) - cv2 <- cv() daemons(url = url, remote = remote, dispatcher = FALSE, resilience = FALSE, cleanup = FALSE, ..., .compute = id) if (length(remote)) { @@ -117,7 +117,6 @@ make_cluster <- function(n, url = NULL, remote = NULL, ...) { } else { is.numeric(n) || stop(._[["numeric_n"]]) n >= 1L || stop(._[["n_one"]]) - cv2 <- cv() daemons(n = n, dispatcher = FALSE, resilience = FALSE, cleanup = FALSE, ..., .compute = id) } @@ -159,12 +158,10 @@ sendData.miraiNode <- function(node, data) { value <- data[["data"]] tagged <- !is.null(value[["tag"]]) - tagged && { envir[["swapped"]] || cv_swap(envir, TRUE) } || { envir[["swapped"]] && cv_swap(envir, FALSE) } + tagged && (envir[["swapped"]] || cv_swap(envir, TRUE)) || (envir[["swapped"]] && cv_swap(envir, FALSE)) m <- mirai(do.call(node, data, quote = TRUE), node = value[["fun"]], data = value[["args"]], .compute = id) - if (tagged) assign("tag", value[["tag"]], m) - `[[<-`(node, "mirai", m) }