Add an HTTP timeout for the healthcheck
This commit is contained in:
parent
03f4b46189
commit
d9b82255b9
|
@ -8,8 +8,9 @@ defmodule Pleroma.Search.Healthcheck do
|
||||||
use GenServer
|
use GenServer
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@tick :timer.seconds(5)
|
|
||||||
@queue :search_indexing
|
@queue :search_indexing
|
||||||
|
@tick :timer.seconds(5)
|
||||||
|
@timeout :timer.seconds(2)
|
||||||
|
|
||||||
def start_link(_) do
|
def start_link(_) do
|
||||||
GenServer.start_link(__MODULE__, [], name: __MODULE__)
|
GenServer.start_link(__MODULE__, [], name: __MODULE__)
|
||||||
|
@ -59,7 +60,7 @@ def check(urls) when is_list(urls) do
|
||||||
Enum.all?(
|
Enum.all?(
|
||||||
urls,
|
urls,
|
||||||
fn url ->
|
fn url ->
|
||||||
case Pleroma.HTTP.get(url) do
|
case Pleroma.HTTP.get(url, [], recv_timeout: @timeout) do
|
||||||
{:ok, %{status: 200}} -> true
|
{:ok, %{status: 200}} -> true
|
||||||
_ -> false
|
_ -> false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue