From b490867112cdbd619f2b6e14be600617f77867f7 Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Tue, 5 Dec 2023 09:41:37 +0000 Subject: [PATCH] more code style --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/daemons.R | 6 +++--- R/dispatcher.R | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 82ac5a5d3..45de08bbf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mirai Type: Package Title: Minimalist Async Evaluation Framework for R -Version: 0.11.2.9023 +Version: 0.11.2.9024 Description: Lightweight parallel code execution and distributed computing. Designed for simplicity, a 'mirai' evaluates an R expression asynchronously, on local or network resources, resolving automatically upon completion. diff --git a/NEWS.md b/NEWS.md index feaaeb943..f4bc2542a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# mirai 0.11.2.9023 (development) +# mirai 0.11.2.9024 (development) * Implements `register()` for registering custom serialization and unserialization functions when using daemons. * Introduces `call_mirai_()`, a user-interruptible version of `call_mirai()` suitable for interactive use. diff --git a/R/daemons.R b/R/daemons.R index 3162f256f..117fbd018 100644 --- a/R/daemons.R +++ b/R/daemons.R @@ -563,9 +563,9 @@ launch_and_sync_daemon <- function(sock, ..., rs = NULL, tls = NULL, pass = NULL init_monitor <- function(sockc, envir) { res <- query_dispatcher(sockc, command = FALSE, mode = 2L) - is.object(res) && return(FALSE) - `[[<-`(`[[<-`(`[[<-`(envir, "sockc", sockc), "urls", res[-1L]), "pid", as.integer(res[1L])) - TRUE + valid <- !is.object(res) + if (valid) `[[<-`(`[[<-`(`[[<-`(envir, "sockc", sockc), "urls", res[-1L]), "pid", as.integer(res[1L])) + valid } store_urls <- function(sock, envir) { diff --git a/R/dispatcher.R b/R/dispatcher.R index 426b41412..5454a2500 100644 --- a/R/dispatcher.R +++ b/R/dispatcher.R @@ -309,8 +309,7 @@ get_tls <- function(baseurl, tls, pass) { sub_real_port <- function(port, url) sub("(?<=:)0(?![^/])", port, url, perl = TRUE) query_dispatcher <- function(sock, command, mode) { - res <- send(sock, data = command, mode = 2L, block = .timelimit) - res && return(res) + send(sock, data = command, mode = 2L, block = .timelimit) recv(sock, mode = mode, block = .timelimit + .timelimit) }