Use erlang monotonic time for CRF calculation
This commit is contained in:
parent
00926a63fb
commit
7882f28569
@ -12,7 +12,7 @@ def start_link([key | _] = opts) do
|
|||||||
def init([key, uri, opts, client_pid]) do
|
def init([key, uri, opts, client_pid]) do
|
||||||
with {:ok, conn_pid} <- Gun.Conn.open(uri, opts),
|
with {:ok, conn_pid} <- Gun.Conn.open(uri, opts),
|
||||||
Process.link(conn_pid) do
|
Process.link(conn_pid) do
|
||||||
time = :os.system_time(:second)
|
time = :erlang.monotonic_time()
|
||||||
|
|
||||||
{_, _} =
|
{_, _} =
|
||||||
Registry.update_value(@registry, key, fn _ ->
|
Registry.update_value(@registry, key, fn _ ->
|
||||||
@ -31,7 +31,7 @@ def init([key, uri, opts, client_pid]) do
|
|||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_cast({:add_client, client_pid, send_pid_back}, %{key: key} = state) do
|
def handle_cast({:add_client, client_pid, send_pid_back}, %{key: key} = state) do
|
||||||
time = :os.system_time(:second)
|
time = :erlang.monotonic_time()
|
||||||
|
|
||||||
{{conn_pid, _, _, _}, _} =
|
{{conn_pid, _, _, _}, _} =
|
||||||
Registry.update_value(@registry, key, fn {conn_pid, used_by, crf, last_reference} ->
|
Registry.update_value(@registry, key, fn {conn_pid, used_by, crf, last_reference} ->
|
||||||
|
Loading…
Reference in New Issue
Block a user