1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Workers.WorkerHelper do
8 def worker_args(queue) do
9 case Config.get([:workers, :retries, queue]) do
11 max_attempts -> [max_attempts: max_attempts]
15 def sidekiq_backoff(attempt, pow \\ 4, base_backoff \\ 15) do
17 :math.pow(attempt, pow) +
19 :rand.uniform(2 * base_backoff) * attempt