[#1149] Added more oban workers. Refactoring.
[akkoma] / lib / pleroma / workers / web_pusher.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Workers.WebPusher do
6 alias Pleroma.Notification
7 alias Pleroma.Repo
8
9 # Note: `max_attempts` is intended to be overridden in `new/1` call
10 use Oban.Worker,
11 queue: "web_push",
12 max_attempts: Pleroma.Config.get([:workers, :retries, :compile_time_default])
13
14 @impl Oban.Worker
15 def perform(%{"op" => "web_push", "notification_id" => notification_id}) do
16 notification = Repo.get(Notification, notification_id)
17 Pleroma.Web.Push.Impl.perform(notification)
18 end
19 end