Skip to content

Commit 25fff3e

Browse files
authored
Streamline daemons() logic (#385)
1 parent ef60fbe commit 25fff3e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R/daemons.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,15 @@ daemons <- function(
260260
is.numeric(n) || stop(._[["numeric_n"]])
261261
n <- as.integer(n)
262262

263-
if (n == 0L) {
263+
n == 0L && {
264264
is.null(envir) && return(0L)
265265

266266
if (signal) send_signal(envir)
267267
reap(envir[["sock"]])
268268
..[[.compute]] <- NULL -> envir
269-
} else if (is.null(envir)) {
269+
return(0L)
270+
}
271+
if (is.null(envir)) {
270272
n > 0L || stop(._[["n_zero"]])
271273
dynGet(".mirai_within_map", ifnotfound = FALSE) && stop(._[["within_map"]])
272274
envir <- init_envir_stream(seed)
@@ -284,7 +286,6 @@ daemons <- function(
284286
}
285287
}
286288

287-
is.null(envir) && return(0L)
288289
`class<-`(envir[["n"]], c("miraiDaemons", .compute))
289290
}
290291

0 commit comments

Comments
 (0)