config :pleroma, :suggestions,
enabled: false,
third_party_engine:
- "http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-suggestions-api.cgi?{{host}}+{{user}}"
+ "http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-suggestions-api.cgi?{{host}}+{{user}}",
+ timeout: 300_000
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
def suggestions(%{assigns: %{user: user}} = conn, _) do
if Keyword.get(@suggestions, :enabled, false) do
- api = Keyword.get(@suggestions, :third_party_engine, false)
+ api = Keyword.get(@suggestions, :third_party_engine, "")
+ timeout = Keyword.get(@suggestions, :timeout, 5000)
host =
Application.get_env(:pleroma, Pleroma.Web.Endpoint)
url = String.replace(api, "{{host}}", host) |> String.replace("{{user}}", user)
with {:ok, %{status_code: 200, body: body}} <-
- @httpoison.get(url, [], timeout: 300_000, recv_timeout: 300_000),
+ @httpoison.get(url, [], timeout: timeout, recv_timeout: timeout),
{:ok, data} <- Jason.decode(body) do
data2 =
Enum.slice(data, 0, 40)
metadata: %{
nodeName: Keyword.get(instance, :name),
mediaProxy: Keyword.get(media_proxy, :enabled),
- suggestions: Keyword.get(suggestions, :enabled, false),
- suggestionsThirdPartyEngine: Keyword.get(suggestions, :third_party_engine, false)
+ suggestions: %{
+ enabled: Keyword.get(suggestions, :enabled, false),
+ thirdPartyEngine: Keyword.get(suggestions, :third_party_engine, ""),
+ timeout: Keyword.get(suggestions, :timeout, 5000)
+ }
}
}