Skip to content

Commit d03ce86

Browse files
cancel() ignores 'interrupt = TRUE', if interrupts are disabled for the backend
1 parent b2d4444 commit d03ce86

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future
2-
Version: 1.58.0-9015
2+
Version: 1.58.0-9016
33
Title: Unified Parallel and Distributed Processing in R for Everyone
44
Depends:
55
R (>= 3.2.0)

R/core_api-cancel.R

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,17 @@ cancel.Future <- function(x, interrupt = TRUE, ...) {
9696
if (is.null(backend)) {
9797
stop(FutureError(sprintf("Interruption of futures require a backend implementing the FutureBackend API: %s", sQuote(class(future)[1]))))
9898
}
99-
local({
100-
if (debug) {
101-
mdebugf_push("interruptFuture(<%s>, future = <%s>, ...) ...", class(backend)[1], class(future)[1])
102-
on.exit(mdebug_pop())
103-
}
104-
interruptFuture(backend, future = future, ...)
105-
})
99+
if (isTRUE(backend[["interrupts"]])) {
100+
local({
101+
if (debug) {
102+
mdebugf_push("interruptFuture(<%s>, future = <%s>, ...) ...", class(backend)[1], class(future)[1])
103+
on.exit(mdebug_pop())
104+
}
105+
interruptFuture(backend, future = future, ...)
106+
})
107+
} else {
108+
if (debug) mdebugf("Ignoring the interrupt request, because interrupts have been disabled for this backend")
109+
}
106110
}
107111

108112
future[["state"]] <- "canceled"

0 commit comments

Comments
 (0)