Skip to content

Commit

Permalink
Allow passing in timeout for connect call
Browse files Browse the repository at this point in the history
  • Loading branch information
zacksiri committed Nov 28, 2024
1 parent 6452310 commit 0eb816c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/lexdee/observer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ defmodule Lexdee.Observer do
GenServer.call(pid, :connect)
end

def connect(supervisor, pid) when is_pid(pid) do
def connect(supervisor, pid, timeout \\ 30_000) when is_pid(pid) do
node = which_node(pid)

{supervisor, node}
|> Task.Supervisor.async_nolink(fn ->
GenServer.call(pid, :connect)
GenServer.call(pid, :connect, timeout + 5_000)
end)
|> Task.await()
|> Task.await(timeout + 10_000)
end

def start_link(options) do
Expand Down

0 comments on commit 0eb816c

Please sign in to comment.