move to 2.5.5
[anni] / lib / pleroma / workers / web_pusher_worker.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Workers.WebPusherWorker do
6   alias Pleroma.Notification
7   alias Pleroma.Repo
8
9   use Pleroma.Workers.WorkerHelper, queue: "web_push"
10
11   @impl Oban.Worker
12   def perform(%Job{args: %{"op" => "web_push", "notification_id" => notification_id}}) do
13     notification =
14       Notification
15       |> Repo.get(notification_id)
16       |> Repo.preload([:activity, :user])
17
18     Pleroma.Web.Push.Impl.perform(notification)
19   end
20
21   @impl Oban.Worker
22   def timeout(_job), do: :timer.seconds(5)
23 end