diff --git a/R/daemons.R b/R/daemons.R index 95bf2303..f9dc7c39 100644 --- a/R/daemons.R +++ b/R/daemons.R @@ -258,7 +258,6 @@ daemons <- function(n, url = NULL, remote = NULL, dispatcher = TRUE, ..., check_store_url(sock, envir) }, { - url <- url[1L] tls <- configure_tls(url, tls, pass, envir, returnconfig = FALSE) cv <- cv() dots <- parse_dots(...) @@ -516,10 +515,8 @@ tokenized_url <- function(url) sprintf("%s/%s", url, random(12L)) req_socket <- function(url, tls = NULL, resend = 0L) `opt<-`(socket("req", listen = url, tls = tls), "req:resend-time", resend) -parse_dispatcher <- function(x) { - x <- x[1L] +parse_dispatcher <- function(x) if (is.logical(x)) 1L + (!is.na(x) && x) else if (x == "process" || x == "thread") 3L else if (x == "none") 1L else 4L -} parse_dots <- function(...) { ...length() || return("") diff --git a/R/mirai.R b/R/mirai.R index 238b3dd5..3ce1f3b1 100644 --- a/R/mirai.R +++ b/R/mirai.R @@ -266,7 +266,7 @@ everywhere <- function(.expr, ..., .args = list(), .serial = NULL, .compute = "d vec[[i]] <- mirai(.expr, ..., .args = .args, .compute = .compute) } else { .expr <- c(.block, .expr) - vec <- vector(mode = "list", length = max(status(.compute)[["connections"]], envir[["n"]])) + vec <- vector(mode = "list", length = status(.compute)[["connections"]]) for (i in seq_along(vec)) vec[[i]] <- mirai(.expr, ..., .args = .args, .compute = .compute) } diff --git a/tests/tests.R b/tests/tests.R index 79428961..478aa0e1 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -241,7 +241,7 @@ connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == " # TLS tests connection && Sys.getenv("NOT_CRAN") == "true" && { Sys.sleep(1L) - test_zero(daemons(url = c("tls+tcp://127.0.0.1:0", "wss://127.0.0.1:0"), pass = "test")) + test_zero(daemons(url = "tls+tcp://127.0.0.1:0", pass = "test")) test_equal(launch_local(1L), 1L) Sys.sleep(1L) test_true(grepl("CERTIFICATE", launch_remote(1L), fixed = TRUE)) @@ -304,7 +304,9 @@ connection && Sys.getenv("NOT_CRAN") == "true" && { connection && Sys.getenv("NOT_CRAN") == "true" && { Sys.sleep(1L) q <- vector(mode = "list", length = 10000L) + Sys.setenv(R_DEFAULT_PACKAGES = "stats,utils") test_equal(daemons(4), 4L) + Sys.unsetenv("R_DEFAULT_PACKAGES") for (i in seq_len(10000L)) {q[[i]] <- mirai(1L); attr(q[[i]], "status") <- status()} test_equal(sum(unlist(collect_mirai(q))), 10000L) test_true(all(as.logical(lapply(lapply(q, attr, "status"), is.list))))