Add Cron worker to clean up orphaned apps hourly

This commit is contained in:
Mark Felder 2024-09-04 10:59:58 -04:00
commit a1951f3af7
4 changed files with 41 additions and 1 deletions

View file

@ -165,4 +165,10 @@ defmodule Pleroma.Web.OAuth.App do
end
def maybe_update_owner(_), do: :ok
@spec remove_orphans() :: :ok
def remove_orphans() do
from(a in __MODULE__, where: is_nil(a.user_id))
|> Repo.delete_all()
end
end