Skip to content

Commit

Permalink
clean up lexdee observer
Browse files Browse the repository at this point in the history
  • Loading branch information
zacksiri committed Nov 5, 2024
1 parent 3c9cac9 commit af5d973
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/lexdee/observer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ defmodule Lexdee.Observer do
GenServer.call(pid, :connect)
end

def connect(supervisor, pid) do
def connect(supervisor, pid) when is_pid(pid) do
node = which_node(pid)

task =
Task.Supervisor.async_nolink({supervisor, node}, fn ->
GenServer.call(pid, :connect)
end)

Task.yield(task)
{supervisor, node}
|> Task.Supervisor.async_nolink(fn ->
GenServer.call(pid, :connect)
end)
|> Task.await()
end

def start_link(options) do
Expand Down

0 comments on commit af5d973

Please sign in to comment.