oban v2.1.0 Release Notes
Release Date: 2020-08-21 // over 3 years ago-
๐ Fixed
โ [Oban.Testing] Modify the behaviour checking in
perform_job/3
so that it considers all behaviours.๐ [Oban.Plugins.Pruner] Use distinct names when running multiple Oban instances in the same application.
โ Added
[Oban] In addition to the standard queue-name / limit keyword syntax it is now possible to define per-queue options such as
:poll_interval
,:dispatch_cooldown
,:paused
, and even override the:producer
module.๐ท [Oban] Cancelling a running job now records an error on the job if it was running at the time it was cancelled.
๐ท [Oban.Job] Allow using
:discarded
as a unique state and expose all possible states throughOban.Job.states/0
.๐ท [Oban.Worker] Allow returning
{:discard, reason}
fromperform/1
, where the reason is recorded in the job's errors array. If no reason is provided then a default of "None" is used. All discarded jobs will have an error now, whether discarded manually or automatically.๐ท [Oban.Job] Add support for uniqueness across sub-args with the
:keys
attribute. This makes it possible to only use a few values from a job to determine uniqueness. For example, a job that includes a lot of metadata but must be considered unique based on a:url
field can specifykeys: [:url]
.
๐ Changed
๐ท [Oban.Worker] Wrap
{:error, reason}
and{:discard, reason}
in a properOban.PerformError
exception with a customized message. This ensures that the:error
value passed to telemetry handlers is an exception and not a raw term.๐ท [Oban.Worker] Wrap job timeouts in
Oban.TimeoutError
with a customized message indicating the worker and timeout value. This replaces the raw:timeout
atom that was reported before.๐ท [Oban.Worker] Wrap caught exits and throws in
Oban.CrashError
with a formatted message. This means the:error
value passed to telemetry is always a proper exception and easier to report.๐ท [Oban.Worker] Stop reporting internal stacktraces for timeouts, discards or error tuples. The stacktrace was useless and potentially misleading as it appeared that the error originated from Oban rather than the worker module.