projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4d5161b
)
Use connection pools.
author
lain
<lain@soykaf.club>
Mon, 19 Mar 2018 16:42:09 +0000
(17:42 +0100)
committer
lain
<lain@soykaf.club>
Mon, 19 Mar 2018 16:42:09 +0000
(17:42 +0100)
lib/pleroma/web/activity_pub/activity_pub.ex
patch
|
blob
|
history
lib/pleroma/web/federator/federator.ex
patch
|
blob
|
history
lib/pleroma/web/media_proxy/controller.ex
patch
|
blob
|
history
lib/pleroma/web/salmon/salmon.ex
patch
|
blob
|
history
test/support/httpoison_mock.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/web/activity_pub/activity_pub.ex
b/lib/pleroma/web/activity_pub/activity_pub.ex
index 414b09291308a8c0c619dcb50bca27d6daa2dc2f..d51a227421a06d8669c0014bcfdb2ade121fa327 100644
(file)
--- a/
lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/
lib/pleroma/web/activity_pub/activity_pub.ex
@@
-351,7
+351,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
Logger.info("Federating #{id} to #{inbox}")
host = URI.parse(inbox).host
signature = Pleroma.Web.HTTPSignatures.sign(actor, %{host: host, "content-length": byte_size(json)})
Logger.info("Federating #{id} to #{inbox}")
host = URI.parse(inbox).host
signature = Pleroma.Web.HTTPSignatures.sign(actor, %{host: host, "content-length": byte_size(json)})
- @httpoison.post(inbox, json, [{"Content-Type", "application/activity+json"}, {"signature", signature}])
+ @httpoison.post(inbox, json, [{"Content-Type", "application/activity+json"}, {"signature", signature}]
, hackney: [pool: :default]
)
end
# TODO:
end
# TODO:
diff --git
a/lib/pleroma/web/federator/federator.ex
b/lib/pleroma/web/federator/federator.ex
index 57e11b4fb4e72964bb73e8dd56511b9addcc1955..88475397a342c4e9fd40e92793db5ac230c86b11 100644
(file)
--- a/
lib/pleroma/web/federator/federator.ex
+++ b/
lib/pleroma/web/federator/federator.ex
@@
-96,7
+96,7
@@
defmodule Pleroma.Web.Federator do
with {:ok, %{status_code: code}} <- @httpoison.post(callback, xml, [
{"Content-Type", "application/atom+xml"},
{"X-Hub-Signature", "sha1=#{signature}"}
with {:ok, %{status_code: code}} <- @httpoison.post(callback, xml, [
{"Content-Type", "application/atom+xml"},
{"X-Hub-Signature", "sha1=#{signature}"}
- ], timeout: 10000, recv_timeout: 20000) do
+ ], timeout: 10000, recv_timeout: 20000
, hackney: [pool: :default]
) do
Logger.debug(fn -> "Pushed to #{callback}, code #{code}" end)
else e ->
Logger.debug(fn -> "Couldn't push to #{callback}, #{inspect(e)}" end)
Logger.debug(fn -> "Pushed to #{callback}, code #{code}" end)
else e ->
Logger.debug(fn -> "Couldn't push to #{callback}, #{inspect(e)}" end)
diff --git
a/lib/pleroma/web/media_proxy/controller.ex
b/lib/pleroma/web/media_proxy/controller.ex
index 9327e7253aa949243d63dd4a1de91c7465238552..b0bbe8b64a8c5ef43c65afe8e5aeb96d11699b94 100644
(file)
--- a/
lib/pleroma/web/media_proxy/controller.ex
+++ b/
lib/pleroma/web/media_proxy/controller.ex
@@
-3,7
+3,7
@@
defmodule Pleroma.Web.MediaProxy.MediaProxyController do
require Logger
@httpoison Application.get_env(:pleroma, :httpoison)
require Logger
@httpoison Application.get_env(:pleroma, :httpoison)
-
+
@max_body_length 25 * 1048576
@cache_control %{
@max_body_length 25 * 1048576
@cache_control %{
@@
-31,7
+31,7
@@
defmodule Pleroma.Web.MediaProxy.MediaProxyController do
defp proxy_request(link) do
headers = [{"user-agent", "Pleroma/MediaProxy; #{Pleroma.Web.base_url()} <#{Application.get_env(:pleroma, :instance)[:email]}>"}]
defp proxy_request(link) do
headers = [{"user-agent", "Pleroma/MediaProxy; #{Pleroma.Web.base_url()} <#{Application.get_env(:pleroma, :instance)[:email]}>"}]
- options = @httpoison.process_request_options([:insecure, {:follow_redirect, true}])
+ options = @httpoison.process_request_options([:insecure, {:follow_redirect, true}])
++ [{:pool, :default}]
with \
{:ok, 200, headers, client} <- :hackney.request(:get, link, headers, "", options),
headers = Enum.into(headers, Map.new),
with \
{:ok, 200, headers, client} <- :hackney.request(:get, link, headers, "", options),
headers = Enum.into(headers, Map.new),
diff --git
a/lib/pleroma/web/salmon/salmon.ex
b/lib/pleroma/web/salmon/salmon.ex
index 46ca645d1d37352c2d5545a44eca0751f23ee53d..db1429c5ef0c1b3294a32e97e30865be43472258 100644
(file)
--- a/
lib/pleroma/web/salmon/salmon.ex
+++ b/
lib/pleroma/web/salmon/salmon.ex
@@
-147,7
+147,7
@@
defmodule Pleroma.Web.Salmon do
end
defp send_to_user(%{info: %{"salmon" => salmon}}, feed, poster) do
end
defp send_to_user(%{info: %{"salmon" => salmon}}, feed, poster) do
- with {:ok, %{status_code: code}} <- poster.(salmon, feed, [{"Content-Type", "application/magic-envelope+xml"}], timeout: 10000, recv_timeout: 20000) do
+ with {:ok, %{status_code: code}} <- poster.(salmon, feed, [{"Content-Type", "application/magic-envelope+xml"}], timeout: 10000, recv_timeout: 20000
, hackney: [pool: :default]
) do
Logger.debug(fn -> "Pushed to #{salmon}, code #{code}" end)
else
e -> Logger.debug(fn -> "Pushing salmon to #{salmon} failed, #{inspect(e)}" end)
Logger.debug(fn -> "Pushed to #{salmon}, code #{code}" end)
else
e -> Logger.debug(fn -> "Pushing salmon to #{salmon} failed, #{inspect(e)}" end)
diff --git
a/test/support/httpoison_mock.ex
b/test/support/httpoison_mock.ex
index a8b1a60c04a805b03a1a20eb3c7aab944c8c350f..a45eaf17062b820142c23e8303b266490a4732cb 100644
(file)
--- a/
test/support/httpoison_mock.ex
+++ b/
test/support/httpoison_mock.ex
@@
-450,4
+450,8
@@
defmodule HTTPoisonMock do
def post(url, body, headers) do
{:error, "Not implemented the mock response for post #{inspect(url)}"}
end
def post(url, body, headers) do
{:error, "Not implemented the mock response for post #{inspect(url)}"}
end
+
+ def post(url, body, headers, options) do
+ {:error, "Not implemented the mock response for post #{inspect(url)}"}
+ end
end
end