Skip to content

Job Queue

minibikini requested to merge minibikini/pleroma:feature/jobs into develop

What it does

  • Moves job queue logic from Pleroma.Web.Federator to Pleroma.Jobs module.
  • Allows adding new queues for different kinds of tasks (not only federation). The MR includes :federator_incoming and :federator_outgoing queues.
  • Every queue has own max_jobs setting


@spec enqueue(atom(), atom(), [any()], integer()) :: :ok
Pleroma.Jobs.enqueue(queue_name, mod, args, priority \\ 1)


  • queue_name - a queue name (must be specified in the config).
  • mod - a worker module (must have perform function).
  • args - a list of arguments for the perform function of the worker module.
  • priority - a job priority (0 by default).


Enqueue Module.perform/0 with priority=1:

Pleroma.Jobs.enqueue(:example_queue, Module, [])

Enqueue Module.perform(:job_name) with priority=5:

Pleroma.Jobs.enqueue(:example_queue, Module, [:job_name], 5)

Enqueue Module.perform(:another_job, data) with priority=1:

data = "foobar"
Pleroma.Jobs.enqueue(:example_queue, Module, [:another_job, data])

Enqueue Module.perform(:foobar_job, :foo, :bar, 42) with priority=1:

Pleroma.Jobs.enqueue(:example_queue, Module, [:foobar_job, :foo, :bar, 42])


  • Should I Pleroma.Web.Federator.RetryQueue -> Pleroma.Jobs.RetryQueue? ATM RetryQueue is used by Federator only and has some federation logic.
Edited by minibikini

Merge request reports