Fix test to know whether we should perform unused accounts cleanup
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
3ad5f8977e
commit
b484629010
|
@ -15,13 +15,13 @@ defmodule Mobilizon.Service.Workers.CleanUnconfirmedUsersWorker do
|
||||||
|
|
||||||
@spec should_perform? :: boolean()
|
@spec should_perform? :: boolean()
|
||||||
defp should_perform? do
|
defp should_perform? do
|
||||||
case Cachex.get(:key_value, "last_media_cleanup") do
|
case Cachex.get(:key_value, "unconfirmed_users_cleanup") do
|
||||||
{:ok, %DateTime{} = last_media_cleanup} ->
|
{:ok, %DateTime{} = unconfirmed_users_cleanup} ->
|
||||||
default_grace_period =
|
default_grace_period =
|
||||||
Mobilizon.Config.get([:instance, :unconfirmed_user_grace_period_hours], 48)
|
Mobilizon.Config.get([:instance, :unconfirmed_user_grace_period_hours], 48)
|
||||||
|
|
||||||
DateTime.compare(
|
DateTime.compare(
|
||||||
last_media_cleanup,
|
unconfirmed_users_cleanup,
|
||||||
DateTime.add(DateTime.utc_now(), default_grace_period * -3600)
|
DateTime.add(DateTime.utc_now(), default_grace_period * -3600)
|
||||||
) == :lt
|
) == :lt
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue