Skip to content

Commit 9289436

Browse files
committed
Forward progression properties when relaying a progression
When the progression condition that is to be relayed was created with any arguments, they need to be relayed as well when creating a new progression object in progress_aggregator(). Fixes #126.
1 parent da3dc98 commit 9289436

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

R/progress_aggregator.R

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ progress_aggregator <- function(progress) {
3131
} else if (type == "reset") {
3232
} else if (type == "shutdown") {
3333
} else if (type == "update") {
34-
progress(child = p)
34+
call_progressor_with_progress(progress, p)
3535
} else {
3636
stop("Unknown 'progression' type: ", sQuote(type))
3737
}
@@ -49,3 +49,18 @@ progress_aggregator <- function(progress) {
4949

5050
fcn
5151
}
52+
53+
call_progressor_with_progress <- function(progr, prog_cond){
54+
c <- setdiff(class(prog_cond), c("progression", "immediateCondition", "condition"))
55+
arg_list <- unclass(prog_cond)
56+
# Remove all arguments from the list that are not included by the progressor
57+
# (the function generated by a call to the progressor() function) into the
58+
# resulting condition object but are set by the progressor itself. See
59+
# the function that is the return value of progressor() for those arguments.
60+
arg_list$owner_session_uuid <- NULL
61+
arg_list$progressor_uuid <- NULL
62+
arg_list$progression_index <- NULL
63+
arg_list$call <- NULL
64+
arg_list$calls <- NULL
65+
do.call(progr, arg_list)
66+
}

R/progressor.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ progressor <- local({
8686
type = type,
8787
message = message,
8888
...,
89+
# If adding values here that do not come from the parameters of this
90+
# inner function, include them in call_progressor_with_progress() as
91+
# well
8992
progressor_uuid = progressor_uuid,
9093
progression_index = progression_index,
9194
owner_session_uuid = owner_session_uuid,

0 commit comments

Comments
 (0)