purge chat and shout endpoints
[akkoma] / lib / pleroma / application.ex
index 5801e930dc91a01e91c0129a7fb0633af552f134..6bda2e1d97f7396085c7b20d89aa10a99633d52a 100644 (file)
@@ -77,8 +77,7 @@ defmodule Pleroma.Application do
         ] ++
         elasticsearch_children() ++
         task_children(@mix_env) ++
-        dont_run_in_test(@mix_env) ++
-        shout_child(shout_enabled?())
+        dont_run_in_test(@mix_env)
 
     # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
     # for other strategies and supported options
@@ -93,11 +92,16 @@ defmodule Pleroma.Application do
       end
 
     opts = [strategy: :one_for_one, name: Pleroma.Supervisor, max_restarts: max_restarts]
-    result = Supervisor.start_link(children, opts)
 
-    set_postgres_server_version()
-
-    result
+    with {:ok, data} <- Supervisor.start_link(children, opts) do
+      set_postgres_server_version()
+      {:ok, data}
+    else
+      e ->
+        Logger.error("Failed to start!")
+        Logger.error("#{inspect(e)}")
+        e
+    end
   end
 
   defp set_postgres_server_version do
@@ -173,11 +177,7 @@ defmodule Pleroma.Application do
       build_cachex("web_resp", limit: 2500),
       build_cachex("emoji_packs", expiration: emoji_packs_expiration(), limit: 10),
       build_cachex("failed_proxy_url", limit: 2500),
-      build_cachex("banned_urls", default_ttl: :timer.hours(24 * 30), limit: 5_000),
-      build_cachex("chat_message_id_idempotency_key",
-        expiration: chat_message_id_idempotency_key_expiration(),
-        limit: 500_000
-      )
+      build_cachex("banned_urls", default_ttl: :timer.hours(24 * 30), limit: 5_000)
     ]
   end
 
@@ -187,9 +187,6 @@ defmodule Pleroma.Application do
   defp idempotency_expiration,
     do: expiration(default: :timer.seconds(6 * 60 * 60), interval: :timer.seconds(60))
 
-  defp chat_message_id_idempotency_key_expiration,
-    do: expiration(default: :timer.minutes(2), interval: :timer.seconds(60))
-
   defp seconds_valid_interval,
     do: :timer.seconds(Config.get!([Pleroma.Captcha, :seconds_valid]))
 
@@ -201,8 +198,6 @@ defmodule Pleroma.Application do
       type: :worker
     }
 
-  defp shout_enabled?, do: Config.get([:shout, :enabled])
-
   defp dont_run_in_test(env) when env in [:test, :benchmark], do: []
 
   defp dont_run_in_test(_) do
@@ -222,15 +217,6 @@ defmodule Pleroma.Application do
     ]
   end
 
-  defp shout_child(true) do
-    [
-      Pleroma.Web.ShoutChannel.ShoutChannelState,
-      {Phoenix.PubSub, [name: Pleroma.PubSub, adapter: Phoenix.PubSub.PG2]}
-    ]
-  end
-
-  defp shout_child(_), do: []
-
   defp task_children(:test) do
     [
       %{