Skip to content

Commit

Permalink
Use mirai::call_mirai_() instead of manual polling
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Apr 12, 2024
1 parent 1cde4b1 commit 85240fe
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: future.mirai
Version: 0.1.1-9014
Version: 0.1.1-9015
Depends:
future
Imports:
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ importFrom(future,resolved)
importFrom(future,result)
importFrom(future,run)
importFrom(future,tweak)
importFrom(mirai,call_mirai_)
importFrom(mirai,daemons)
importFrom(mirai,is_error_value)
importFrom(mirai,mirai)
7 changes: 2 additions & 5 deletions R/MiraiFuture-class.R
Original file line number Diff line number Diff line change
@@ -152,6 +152,7 @@ mirai_version <- local({
})

#' @importFrom future result
#' @importFrom mirai call_mirai_
#' @export
result.MiraiFuture <- function(future, ...) {
if(isTRUE(future[["state"]] == "finished")) {
@@ -165,11 +166,7 @@ result.MiraiFuture <- function(future, ...) {
}

mirai <- future[["mirai"]]
while (unresolved(mirai)) {
Sys.sleep(0.1)
}

result <- mirai$data
result <- call_mirai_(mirai)$data
future[["result"]] <- result
future[["state"]] <- "finished"

0 comments on commit 85240fe

Please sign in to comment.