Add an HTTP timeout for the healthcheck

This commit is contained in:
Mark Felder 2024-05-26 15:23:12 -04:00
parent 03f4b46189
commit d9b82255b9
1 changed files with 3 additions and 2 deletions

View File

@ -8,8 +8,9 @@ defmodule Pleroma.Search.Healthcheck do
use GenServer
require Logger
@tick :timer.seconds(5)
@queue :search_indexing
@tick :timer.seconds(5)
@timeout :timer.seconds(2)
def start_link(_) do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
@ -59,7 +60,7 @@ def check(urls) when is_list(urls) do
Enum.all?(
urls,
fn url ->
case Pleroma.HTTP.get(url) do
case Pleroma.HTTP.get(url, [], recv_timeout: @timeout) do
{:ok, %{status: 200}} -> true
_ -> false
end