diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-09-26 18:49:57 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-09-26 18:49:57 +0700 |
commit | 75290cbfbd0f93cf3ecec5f44c4624b8c8601c51 (patch) | |
tree | 83a844996f91480c4d6701d4b379f0a90ad2fcb1 /lib/pleroma/healthcheck.ex | |
parent | 6abe12dceda8d0d32878208987a9631d5d546a3d (diff) | |
download | pleroma-75290cbfbd0f93cf3ecec5f44c4624b8c8601c51.tar.gz |
Add Pleroma.JobQueueMonitor
Diffstat (limited to 'lib/pleroma/healthcheck.ex')
-rw-r--r-- | lib/pleroma/healthcheck.ex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/pleroma/healthcheck.ex b/lib/pleroma/healthcheck.ex index 977b78c26..fc2129815 100644 --- a/lib/pleroma/healthcheck.ex +++ b/lib/pleroma/healthcheck.ex @@ -14,6 +14,7 @@ defmodule Pleroma.Healthcheck do active: 0, idle: 0, memory_used: 0, + job_queue_stats: nil, healthy: true @type t :: %__MODULE__{ @@ -21,6 +22,7 @@ defmodule Pleroma.Healthcheck do active: non_neg_integer(), idle: non_neg_integer(), memory_used: number(), + job_queue_stats: map(), healthy: boolean() } @@ -30,6 +32,7 @@ defmodule Pleroma.Healthcheck do memory_used: Float.round(:erlang.memory(:total) / 1024 / 1024, 2) } |> assign_db_info() + |> assign_job_queue_stats() |> check_health() end @@ -55,6 +58,11 @@ defmodule Pleroma.Healthcheck do 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 |