Skip to content

Commit

Permalink
Up
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Sep 19, 2024
1 parent 59f7237 commit ca6d4a8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/kino/terminator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ defmodule Kino.Terminator do
if pid do
terminator = cross_node_name()

with :ok <- Kino.Bridge.reference_object(pid, parent),
:ok <- Kino.Bridge.monitor_object(pid, terminator, {:terminate, pid}, ack?: true) do
:ok
else
# If we fail to reference the object, it means the group
# leader terminated, so we immediately terminate the started
# process
_ -> send(terminator, {:terminate, pid})
Kino.Bridge.reference_object(pid, parent)

with {:request_error, :terminated} <-
Kino.Bridge.monitor_object(pid, terminator, {:terminate, pid}, ack?: true) do
# If the group leader terminated, it is not going to monitor
# the process as we expect, so we terminate it immediately
send(terminator, {:terminate, pid})
end
end

Expand Down

0 comments on commit ca6d4a8

Please sign in to comment.