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 through Oban.Job.states/0.

    • ๐Ÿ‘ท [Oban.Worker] Allow returning {:discard, reason} from perform/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 specify keys: [:url].

    ๐Ÿ”„ Changed

    • ๐Ÿ‘ท [Oban.Worker] Wrap {:error, reason} and {:discard, reason} in a proper Oban.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.