fix Cron.PurgeExpiredActivitiesWorker

This commit is contained in:
Maksim Pechnikov 2020-08-13 21:01:21 +03:00
parent 14a06e63f6
commit 3515cb5c3a

View File

@ -21,11 +21,12 @@ defmodule Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker do
@impl Oban.Worker @impl Oban.Worker
def perform(_job) do def perform(_job) do
if Config.get([ActivityExpiration, :enabled]) do if Config.get([ActivityExpiration, :enabled]) do
Enum.each(ActivityExpiration.due_expirations(@interval), &delete_activity/1) Enum.each(ActivityExpiration.due_expirations(@interval), &delete_activity/1)
else end
:ok
end after
:ok
end end
def delete_activity(%ActivityExpiration{activity_id: activity_id}) do def delete_activity(%ActivityExpiration{activity_id: activity_id}) do
@ -41,7 +42,7 @@ def delete_activity(%ActivityExpiration{activity_id: activity_id}) do
{:user, _} -> {:user, _} ->
Logger.error( Logger.error(
"#{__MODULE__} Couldn't delete expired activity: not found actorof ##{activity_id}" "#{__MODULE__} Couldn't delete expired activity: not found actor of ##{activity_id}"
) )
end end
end end