poolboy timeout fix
[akkoma] / lib / pleroma / http / connection.ex
index 85918341a31fc2722b3db5e4eef44a32d2cb815f..e2d7afbbde19850e9ef64c8673c752d773614686 100644 (file)
@@ -33,8 +33,14 @@ defmodule Pleroma.HTTP.Connection do
   end
 
   defp pool_timeout(opts) do
-    timeout =
-      Config.get([:pools, opts[:pool], :timeout]) || Config.get([:pools, :default, :timeout])
+    {config_key, default} =
+      if Application.get_env(:tesla, :adapter) == Tesla.Adapter.Gun do
+        {:pools, Config.get([:pools, :default, :timeout])}
+      else
+        {:hackney_pools, 10_000}
+      end
+
+    timeout = Config.get([config_key, opts[:pool], :timeout], default)
 
     Keyword.merge(opts, timeout: timeout)
   end