Merge branch 'issue/2036-part-2' into 'develop'

[#2036] fixed cron worker

See merge request pleroma/pleroma!2886
This commit is contained in:
feld 2020-08-13 21:35:40 +00:00
commit 014f91c1c3
5 changed files with 10 additions and 11 deletions

View File

@ -16,8 +16,8 @@ defmodule Pleroma.Workers.Cron.ClearOauthTokenWorker do
def perform(_job) do def perform(_job) do
if Config.get([:oauth2, :clean_expired_tokens], false) do if Config.get([:oauth2, :clean_expired_tokens], false) do
Token.delete_expired_tokens() Token.delete_expired_tokens()
else
:ok
end end
:ok
end end
end end

View File

@ -37,9 +37,9 @@ def perform(_job) do
) )
|> Repo.all() |> Repo.all()
|> send_emails |> send_emails
else
:ok
end end
:ok
end end
def send_emails(users) do def send_emails(users) do

View File

@ -55,11 +55,9 @@ def perform(_job) do
|> Repo.all() |> Repo.all()
|> Enum.map(&Pleroma.Emails.NewUsersDigestEmail.new_users(&1, users_and_statuses)) |> Enum.map(&Pleroma.Emails.NewUsersDigestEmail.new_users(&1, users_and_statuses))
|> Enum.each(&Pleroma.Emails.Mailer.deliver/1) |> Enum.each(&Pleroma.Emails.Mailer.deliver/1)
else
:ok
end end
else
:ok
end end
:ok
end end
end end

View File

@ -23,9 +23,9 @@ defmodule Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker do
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
:ok
end 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 +41,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

View File

@ -12,5 +12,6 @@ defmodule Pleroma.Workers.Cron.StatsWorker do
@impl Oban.Worker @impl Oban.Worker
def perform(_job) do def perform(_job) do
Pleroma.Stats.do_collect() Pleroma.Stats.do_collect()
:ok
end end
end end