@ remove workerhelper
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
1ba53dc2f0
commit
f6b3fb9753
6 changed files with 17 additions and 11 deletions
|
@ -204,7 +204,8 @@ defp insert_activity_with_expiration(data, local, recipients) do
|
|||
end
|
||||
|
||||
def notify_and_stream(activity) do
|
||||
NotificationWorker.enqueue("create", %{"activity_id" => activity.id})
|
||||
NotificationWorker.new(%{"op" => "create", "activity_id" => activity.id})
|
||||
|> Oban.insert()
|
||||
|
||||
original_activity =
|
||||
case activity do
|
||||
|
|
|
@ -41,9 +41,11 @@ def create(%{body_params: params} = conn, _) do
|
|||
{:domain_not_used, params[:domain] !== Pleroma.Web.WebFinger.host()},
|
||||
{:ok, domain} <- Domain.create(params),
|
||||
_ <- @cachex.del(:domain_cache, :domains_list) do
|
||||
Pleroma.Workers.CheckDomainResolveWorker.enqueue("check_domain_resolve", %{
|
||||
Pleroma.Workers.CheckDomainResolveWorker.new(%{
|
||||
"op" => "check_domain_resolve",
|
||||
"id" => domain.id
|
||||
})
|
||||
|> Oban.insert()
|
||||
|
||||
render(conn, "show.json", domain: domain)
|
||||
else
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Workers.CheckDomainResolveWorker do
|
||||
use Pleroma.Workers.WorkerHelper, queue: "check_domain_resolve"
|
||||
use Oban.Worker, queue: :check_domain_resolve
|
||||
|
||||
alias Pleroma.Domain
|
||||
alias Pleroma.HTTP
|
||||
|
@ -11,7 +11,7 @@ defmodule Pleroma.Workers.CheckDomainResolveWorker do
|
|||
alias Pleroma.Web.Endpoint
|
||||
alias Pleroma.Web.WebFinger
|
||||
|
||||
@impl Oban.Worker
|
||||
@impl true
|
||||
def perform(%Job{args: %{"id" => domain_id}}) do
|
||||
domain = Domain.get(domain_id)
|
||||
|
||||
|
@ -31,6 +31,6 @@ def perform(%Job{args: %{"id" => domain_id}}) do
|
|||
|> Repo.update()
|
||||
end
|
||||
|
||||
@impl Oban.Worker
|
||||
@impl true
|
||||
def timeout(_job), do: :timer.seconds(5)
|
||||
end
|
||||
|
|
|
@ -23,11 +23,14 @@ def perform(_job) do
|
|||
|> select([d], d.id)
|
||||
|> Repo.all()
|
||||
|
||||
Enum.each(domains, fn domain_id ->
|
||||
Pleroma.Workers.CheckDomainResolveWorker.enqueue("check_domain_resolve", %{
|
||||
domains
|
||||
|> Enum.map(fn domain_id ->
|
||||
Pleroma.Workers.CheckDomainResolveWorker.new(%{
|
||||
"op" => "check_domain_resolve",
|
||||
"id" => domain_id
|
||||
})
|
||||
end)
|
||||
|> Oban.insert_all()
|
||||
|
||||
:ok
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ defmodule Pleroma.Workers.EventReminderWorker do
|
|||
@moduledoc """
|
||||
Generates notifications for upcoming events.
|
||||
"""
|
||||
use Pleroma.Workers.WorkerHelper, queue: "event_reminders"
|
||||
use Oban.Worker, queue: :event_reminders
|
||||
|
||||
import Ecto.Query
|
||||
|
||||
|
@ -14,7 +14,7 @@ defmodule Pleroma.Workers.EventReminderWorker do
|
|||
alias Pleroma.Notification
|
||||
alias Pleroma.Object
|
||||
|
||||
@impl Oban.Worker
|
||||
@impl true
|
||||
def perform(%Job{args: %{"op" => "event_reminder", "activity_id" => activity_id}}) do
|
||||
with %Activity{} = activity <- find_event_activity(activity_id) do
|
||||
Notification.create_event_notifications(activity)
|
||||
|
|
|
@ -6,12 +6,12 @@ defmodule Pleroma.Workers.NotificationWorker do
|
|||
@moduledoc """
|
||||
Creates notifications for an Activity.
|
||||
"""
|
||||
use Pleroma.Workers.WorkerHelper, queue: "notifications"
|
||||
use Oban.Worker, queue: :notifications
|
||||
|
||||
alias Pleroma.Activity
|
||||
alias Pleroma.Notification
|
||||
|
||||
@impl Oban.Worker
|
||||
@impl true
|
||||
@spec perform(Oban.Job.t()) :: {:error, :activity_not_found} | {:ok, [Pleroma.Notification.t()]}
|
||||
def perform(%Job{args: %{"op" => "create", "activity_id" => activity_id}}) do
|
||||
with %Activity{} = activity <- find_activity(activity_id),
|
||||
|
|
Loading…
Reference in a new issue