WebPush refactoring: separate build and deliver steps

This commit is contained in:
Mark Felder 2024-06-11 17:58:02 -04:00
commit 568819c08a
3 changed files with 97 additions and 79 deletions

View file

@ -5,6 +5,7 @@
defmodule Pleroma.Workers.WebPusherWorker do
alias Pleroma.Notification
alias Pleroma.Repo
alias Pleroma.Web.Push.Impl
use Pleroma.Workers.WorkerHelper, queue: "web_push"
@ -15,7 +16,8 @@ defmodule Pleroma.Workers.WebPusherWorker do
|> Repo.get(notification_id)
|> Repo.preload([:activity, :user])
Pleroma.Web.Push.Impl.perform(notification)
Impl.build(notification)
|> Enum.each(&Impl.deliver(&1))
end
@impl Oban.Worker