analytics/lib/workers/clean_invitations.ex

15 lines
318 B
Elixir
Raw Normal View History

defmodule Plausible.Workers.CleanInvitations do
use Plausible.Repo
use Oban.Worker, queue: :clean_invitations
@impl Oban.Worker
def perform(_job) do
Repo.delete_all(
from i in Plausible.Auth.Invitation,
where: i.inserted_at < fragment("now() - INTERVAL '48 hours'")
)
:ok
end
end