mirror of
https://github.com/plausible/analytics.git
synced 2024-12-22 09:01:40 +03:00
81c12884cd
* Add elixir action * Format the codebase * Add postgresql * Postgres config * Run postgres on localhost * Add clickhouse to CI
16 lines
411 B
Elixir
16 lines
411 B
Elixir
defmodule Plausible.Workers.CleanEmailVerificationCodes do
|
|
use Plausible.Repo
|
|
use Oban.Worker, queue: :clean_email_verification_codes
|
|
|
|
@impl Oban.Worker
|
|
def perform(_args, _job) do
|
|
Repo.update_all(
|
|
from(c in "email_verification_codes",
|
|
where: not is_nil(c.user_id),
|
|
where: c.issued_at < fragment("now() - INTERVAL '4 hours'")
|
|
),
|
|
set: [user_id: nil]
|
|
)
|
|
end
|
|
end
|