From b48462901048d600272705e85be5a5b3e5350680 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 15 Dec 2021 09:47:12 +0100 Subject: [PATCH] Fix test to know whether we should perform unused accounts cleanup Signed-off-by: Thomas Citharel --- lib/service/workers/clean_unconfirmed_users_worker.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/service/workers/clean_unconfirmed_users_worker.ex b/lib/service/workers/clean_unconfirmed_users_worker.ex index ef324caf6..73646beb3 100644 --- a/lib/service/workers/clean_unconfirmed_users_worker.ex +++ b/lib/service/workers/clean_unconfirmed_users_worker.ex @@ -15,13 +15,13 @@ defmodule Mobilizon.Service.Workers.CleanUnconfirmedUsersWorker do @spec should_perform? :: boolean() defp should_perform? do - case Cachex.get(:key_value, "last_media_cleanup") do - {:ok, %DateTime{} = last_media_cleanup} -> + case Cachex.get(:key_value, "unconfirmed_users_cleanup") do + {:ok, %DateTime{} = unconfirmed_users_cleanup} -> default_grace_period = Mobilizon.Config.get([:instance, :unconfirmed_user_grace_period_hours], 48) DateTime.compare( - last_media_cleanup, + unconfirmed_users_cleanup, DateTime.add(DateTime.utc_now(), default_grace_period * -3600) ) == :lt