# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Healthcheck do
active: 0,
idle: 0,
memory_used: 0,
+ job_queue_stats: nil,
healthy: true
@type t :: %__MODULE__{
active: non_neg_integer(),
idle: non_neg_integer(),
memory_used: number(),
+ job_queue_stats: map(),
healthy: boolean()
}
memory_used: Float.round(:erlang.memory(:total) / 1024 / 1024, 2)
}
|> assign_db_info()
+ |> assign_job_queue_stats()
|> check_health()
end
Map.merge(healthcheck, db_info)
end
+ defp assign_job_queue_stats(healthcheck) do
+ stats = Pleroma.JobQueueMonitor.stats()
+ Map.put(healthcheck, :job_queue_stats, stats)
+ end
+
@spec check_health(Healthcheck.t()) :: Healthcheck.t()
def check_health(%{pool_size: pool_size, active: active} = check)
when active >= pool_size do