Skip to content

Commit 6feb22c

Browse files
author
KDr2
committed
check task status
1 parent 9bd2b06 commit 6feb22c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/tapedtask.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ function consume(ttask::TapedTask)
6969

7070
val = try
7171
take!(ttask.produce_ch)
72-
catch e
73-
# return nothing to indicate the finish of the task
74-
isa(e, InvalidStateException) ? nothing : rethrow()
72+
catch
73+
isa(e, InvalidStateException) || rethrow()
74+
istaskfailed(ttask.task) && throw(ttask.task.exception)
75+
# TODO: we return nothing to indicate the end of a task,
76+
# remove this when AdvancedPS is udpated.
77+
istaskdone(ttask.task) && return nothing
7578
end
76-
yield()
7779
isa(val, TapedTaskException) && throw(val.exc)
7880
return val
7981
end

0 commit comments

Comments
 (0)