diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-02-24 19:56:27 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-02-24 19:56:27 +0300 |
commit | 8efae966b1e87fe448a13d04eae0898c4a102c29 (patch) | |
tree | 9c2cb158991e7ac582a9e6b4e2979016ec3a4428 /lib/pleroma/gun/api.ex | |
parent | d44f9e3b6cfd5a0dae07f6194bfd05360afd6560 (diff) | |
download | pleroma-8efae966b1e87fe448a13d04eae0898c4a102c29.tar.gz |
open conn in separate task
Diffstat (limited to 'lib/pleroma/gun/api.ex')
-rw-r--r-- | lib/pleroma/gun/api.ex | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pleroma/gun/api.ex b/lib/pleroma/gun/api.ex index a0c3c5415..f79c9f443 100644 --- a/lib/pleroma/gun/api.ex +++ b/lib/pleroma/gun/api.ex @@ -6,9 +6,10 @@ defmodule Pleroma.Gun.API do @callback open(charlist(), pos_integer(), map()) :: {:ok, pid()} @callback info(pid()) :: map() @callback close(pid()) :: :ok - @callback await_up(pid) :: {:ok, atom()} | {:error, atom()} + @callback await_up(pid, pos_integer()) :: {:ok, atom()} | {:error, atom()} @callback connect(pid(), map()) :: reference() @callback await(pid(), reference()) :: {:response, :fin, 200, []} + @callback set_owner(pid(), pid()) :: :ok def open(host, port, opts), do: api().open(host, port, opts) @@ -16,11 +17,13 @@ defmodule Pleroma.Gun.API do def close(pid), do: api().close(pid) - def await_up(pid), do: api().await_up(pid) + def await_up(pid, timeout \\ 5_000), do: api().await_up(pid, timeout) def connect(pid, opts), do: api().connect(pid, opts) def await(pid, ref), do: api().await(pid, ref) + def set_owner(pid, owner), do: api().set_owner(pid, owner) + defp api, do: Pleroma.Config.get([Pleroma.Gun.API], Pleroma.Gun) end |