+ defp cachex_children do
+ [
+ build_cachex("used_captcha", ttl_interval: seconds_valid_interval()),
+ build_cachex("user", default_ttl: 25_000, ttl_interval: 1000, limit: 2500),
+ build_cachex("object", default_ttl: 25_000, ttl_interval: 1000, limit: 2500),
+ build_cachex("rich_media", default_ttl: :timer.minutes(120), limit: 5000),
+ build_cachex("scrubber", limit: 2500),
+ build_cachex("idempotency", expiration: idempotency_expiration(), limit: 2500),
+ build_cachex("web_resp", limit: 2500),
+ build_cachex("emoji_packs", expiration: emoji_packs_expiration(), limit: 10),
+ build_cachex("failed_proxy_url", limit: 2500)
+ ]
+ end
+
+ defp emoji_packs_expiration,
+ do: expiration(default: :timer.seconds(5 * 60), interval: :timer.seconds(60))
+
+ defp idempotency_expiration,
+ do: expiration(default: :timer.seconds(6 * 60 * 60), interval: :timer.seconds(60))
+
+ defp seconds_valid_interval,
+ do: :timer.seconds(Config.get!([Pleroma.Captcha, :seconds_valid]))
+
+ defp build_cachex(type, opts),
+ do: %{
+ id: String.to_atom("cachex_" <> type),
+ start: {Cachex, :start_link, [String.to_atom(type <> "_cache"), opts]},
+ type: :worker
+ }
+
+ defp chat_enabled?, do: Config.get([:chat, :enabled])
+
+ defp streamer_child(:test), do: []
+
+ defp streamer_child(_) do
+ [Pleroma.Web.Streamer.supervisor()]
+ end
+
+ defp chat_child(_env, true) do
+ [Pleroma.Web.ChatChannel.ChatChannelState]
+ end
+
+ defp chat_child(_, _), do: []