Skip to content

Commit f7d6b59

Browse files
committed
Only call teardown on idle workers
It is an error to call it on busy ones. This might happen on an interrupt.
1 parent d801d65 commit f7d6b59

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

R/parallel.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ queue_teardown <- function(queue) {
320320

321321
topoll <- list()
322322
for (i in seq_len(num)) {
323-
if (!is.null(tasks$worker[[i]])) {
323+
if (
324+
!is.null(tasks$worker[[i]]) && tasks$worker[[i]]$get_state() == "idle"
325+
) {
324326
# The worker might have crashed or exited, so this might fail.
325327
# If it does then we'll just ignore that worker
326328
tryCatch(

0 commit comments

Comments
 (0)