From dd00620b9a54b2b1356855d280e03c82befe15e4 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 6 Jun 2023 12:47:38 +0200 Subject: [PATCH] fix(apps): fix pruning old application device activations Signed-off-by: Thomas Citharel --- lib/mobilizon/applications.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mobilizon/applications.ex b/lib/mobilizon/applications.ex index efa02bbb..57b58cc7 100644 --- a/lib/mobilizon/applications.ex +++ b/lib/mobilizon/applications.ex @@ -426,7 +426,7 @@ defmodule Mobilizon.Applications do @spec prune_old_application_device_activations(pos_integer()) :: {non_neg_integer(), nil} def prune_old_application_device_activations(lifetime) do - exp = DateTime.add(DateTime.utc_now(), -lifetime) + exp = DateTime.utc_now() |> DateTime.add(-lifetime) |> DateTime.to_unix() ApplicationDeviceActivation |> where([at], at.expires_in < ^exp)