Merge branch 'oban-timeouts' into 'develop'
Define sane Oban Worker timeouts See merge request pleroma/pleroma!3777
This commit is contained in:
commit
3d1828f43b
@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Uploadfilter `Pleroma.Upload.Filter.Exiftool` has been renamed to `Pleroma.Upload.Filter.Exiftool.StripLocation`
|
- Uploadfilter `Pleroma.Upload.Filter.Exiftool` has been renamed to `Pleroma.Upload.Filter.Exiftool.StripLocation`
|
||||||
- **Breaking**: `/api/v1/pleroma/backups` endpoints now requires `read:backups` scope instead of `read:accounts`
|
- **Breaking**: `/api/v1/pleroma/backups` endpoints now requires `read:backups` scope instead of `read:accounts`
|
||||||
- Updated the recommended pleroma.vcl configuration for Varnish to target Varnish 7.0+
|
- Updated the recommended pleroma.vcl configuration for Varnish to target Varnish 7.0+
|
||||||
|
- Set timeout values for Oban queues. The default is infinity and some operations may not time out on their own.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- `activeMonth` and `activeHalfyear` fields in NodeInfo usage.users object
|
- `activeMonth` and `activeHalfyear` fields in NodeInfo usage.users object
|
||||||
|
@ -31,6 +31,9 @@ defmodule Pleroma.Workers.AttachmentsCleanupWorker do
|
|||||||
|
|
||||||
def perform(%Job{args: %{"op" => "cleanup_attachments", "object" => _object}}), do: {:ok, :skip}
|
def perform(%Job{args: %{"op" => "cleanup_attachments", "object" => _object}}), do: {:ok, :skip}
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(900)
|
||||||
|
|
||||||
defp do_clean({object_ids, attachment_urls}) do
|
defp do_clean({object_ids, attachment_urls}) do
|
||||||
uploader = Pleroma.Config.get([Pleroma.Upload, :uploader])
|
uploader = Pleroma.Config.get([Pleroma.Upload, :uploader])
|
||||||
|
|
||||||
|
@ -43,4 +43,7 @@ defmodule Pleroma.Workers.BackgroundWorker do
|
|||||||
def perform(%Job{args: %{"op" => "delete_instance", "host" => host}}) do
|
def perform(%Job{args: %{"op" => "delete_instance", "host" => host}}) do
|
||||||
Instance.perform(:delete_instance, host)
|
Instance.perform(:delete_instance, host)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
end
|
end
|
||||||
|
@ -30,6 +30,7 @@ defmodule Pleroma.Workers.BackupWorker do
|
|||||||
|> Oban.insert()
|
|> Oban.insert()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
def perform(%Job{
|
def perform(%Job{
|
||||||
args: %{"op" => "process", "backup_id" => backup_id, "admin_user_id" => admin_user_id}
|
args: %{"op" => "process", "backup_id" => backup_id, "admin_user_id" => admin_user_id}
|
||||||
}) do
|
}) do
|
||||||
@ -49,6 +50,9 @@ defmodule Pleroma.Workers.BackupWorker do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(900)
|
||||||
|
|
||||||
defp has_email?(user) do
|
defp has_email?(user) do
|
||||||
not is_nil(user.email) and user.email != ""
|
not is_nil(user.email) and user.email != ""
|
||||||
end
|
end
|
||||||
|
@ -12,4 +12,7 @@ defmodule Pleroma.Workers.MailerWorker do
|
|||||||
|> :erlang.binary_to_term()
|
|> :erlang.binary_to_term()
|
||||||
|> Pleroma.Emails.Mailer.deliver(config)
|
|> Pleroma.Emails.Mailer.deliver(config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
end
|
end
|
||||||
|
@ -17,4 +17,7 @@ defmodule Pleroma.Workers.MuteExpireWorker do
|
|||||||
Pleroma.Web.CommonAPI.remove_mute(user_id, activity_id)
|
Pleroma.Web.CommonAPI.remove_mute(user_id, activity_id)
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
end
|
end
|
||||||
|
@ -19,6 +19,9 @@ defmodule Pleroma.Workers.PollWorker do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
|
|
||||||
defp find_poll_activity(activity_id) do
|
defp find_poll_activity(activity_id) do
|
||||||
with nil <- Activity.get_by_id(activity_id) do
|
with nil <- Activity.get_by_id(activity_id) do
|
||||||
{:error, :poll_activity_not_found}
|
{:error, :poll_activity_not_found}
|
||||||
|
@ -22,4 +22,7 @@ defmodule Pleroma.Workers.PublisherWorker do
|
|||||||
params = Map.new(params, fn {k, v} -> {String.to_atom(k), v} end)
|
params = Map.new(params, fn {k, v} -> {String.to_atom(k), v} end)
|
||||||
Federator.perform(:publish_one, String.to_atom(module_name), params)
|
Federator.perform(:publish_one, String.to_atom(module_name), params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(10)
|
||||||
end
|
end
|
||||||
|
@ -35,6 +35,9 @@ defmodule Pleroma.Workers.PurgeExpiredActivity do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
|
|
||||||
defp enabled? do
|
defp enabled? do
|
||||||
with false <- Pleroma.Config.get([__MODULE__, :enabled], false) do
|
with false <- Pleroma.Config.get([__MODULE__, :enabled], false) do
|
||||||
{:error, :expired_activities_disabled}
|
{:error, :expired_activities_disabled}
|
||||||
|
@ -31,6 +31,9 @@ defmodule Pleroma.Workers.PurgeExpiredFilter do
|
|||||||
|> Repo.delete()
|
|> Repo.delete()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
|
|
||||||
@spec get_expiration(pos_integer()) :: Job.t() | nil
|
@spec get_expiration(pos_integer()) :: Job.t() | nil
|
||||||
def get_expiration(id) do
|
def get_expiration(id) do
|
||||||
from(j in Job,
|
from(j in Job,
|
||||||
|
@ -26,4 +26,7 @@ defmodule Pleroma.Workers.PurgeExpiredToken do
|
|||||||
|> Pleroma.Repo.get(id)
|
|> Pleroma.Repo.get(id)
|
||||||
|> Pleroma.Repo.delete()
|
|> Pleroma.Repo.delete()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
end
|
end
|
||||||
|
@ -17,4 +17,7 @@ defmodule Pleroma.Workers.ReceiverWorker do
|
|||||||
e -> e
|
e -> e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
end
|
end
|
||||||
|
@ -11,4 +11,7 @@ defmodule Pleroma.Workers.RemoteFetcherWorker do
|
|||||||
def perform(%Job{args: %{"op" => "fetch_remote", "id" => id} = args}) do
|
def perform(%Job{args: %{"op" => "fetch_remote", "id" => id} = args}) do
|
||||||
{:ok, _object} = Fetcher.fetch_object_from_id(id, depth: args["depth"])
|
{:ok, _object} = Fetcher.fetch_object_from_id(id, depth: args["depth"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(10)
|
||||||
end
|
end
|
||||||
|
@ -37,6 +37,9 @@ defmodule Pleroma.Workers.ScheduledActivityWorker do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
|
|
||||||
defp find_scheduled_activity(id) do
|
defp find_scheduled_activity(id) do
|
||||||
with nil <- Repo.get(ScheduledActivity, id) do
|
with nil <- Repo.get(ScheduledActivity, id) do
|
||||||
{:error, :scheduled_activity_not_found}
|
{:error, :scheduled_activity_not_found}
|
||||||
|
@ -12,4 +12,7 @@ defmodule Pleroma.Workers.TransmogrifierWorker do
|
|||||||
user = User.get_cached_by_id(user_id)
|
user = User.get_cached_by_id(user_id)
|
||||||
Pleroma.Web.ActivityPub.Transmogrifier.perform(:user_upgrade, user)
|
Pleroma.Web.ActivityPub.Transmogrifier.perform(:user_upgrade, user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
end
|
end
|
||||||
|
@ -17,4 +17,7 @@ defmodule Pleroma.Workers.WebPusherWorker do
|
|||||||
|
|
||||||
Pleroma.Web.Push.Impl.perform(notification)
|
Pleroma.Web.Push.Impl.perform(notification)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl Oban.Worker
|
||||||
|
def timeout(_job), do: :timer.seconds(5)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user