[#1149] Added more oban workers. Refactoring.
[akkoma] / lib / pleroma / workers / mailer.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.Mailer do
6 alias Pleroma.User
7
8 # Note: `max_attempts` is intended to be overridden in `new/1` call
9 use Oban.Worker,
10 queue: "mailer",
11 max_attempts: Pleroma.Config.get([:workers, :retries, :compile_time_default])
12
13 @impl Oban.Worker
14 def perform(%{"op" => "digest_email", "user_id" => user_id}) do
15 user = User.get_by_id(user_id)
16 Pleroma.DigestEmailWorker.perform(user)
17 end
18 end