From 0eb816c21af03b813a5996db1e399c1403742756 Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Thu, 28 Nov 2024 17:43:51 +0700 Subject: [PATCH] Allow passing in timeout for connect call --- lib/lexdee/observer.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/lexdee/observer.ex b/lib/lexdee/observer.ex index cc24ef6..173893e 100644 --- a/lib/lexdee/observer.ex +++ b/lib/lexdee/observer.ex @@ -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