All Versions
Latest Version
Avg Release Cycle
23 days
Latest Release
33 days ago

Changelog History
Page 2

  • v2.7.2 Changes

    June 10, 2021

    ๐Ÿ›  Fixed

    • [Oban.Plugins.Pruner] Consider cancelled_at or discarded_at timestamps when querying prunable jobs. The previous query required an attempted_at value, even for cancelled or discarded jobs. If a job was cancelled before it was attempted then it wouldn't ever be pruned.

    • ๐Ÿ”Œ [Oban.Plugins.Gossip] Correct exit handling during safe checks. Occasionally, producer checks time out and the previous catch block didn't handle exits properly.

  • v2.7.1 Changes

    May 26, 2021

    ๐Ÿ›  Fixed

    • โช [Oban.Telemetry] Restore the :job key to [:oban, :job, :start] events. It was mistakenly removed during a refactoring.
  • v2.7.0 Changes

    May 25, 2021

    ๐Ÿ”Œ Pluggable Notifier

    The PubSub functionality Oban relies on for starting, stopping, scaling, and pausing queues is now pluggable. The previous notifier was hard-coded to use Postgres for PubSub via LISTEN/NOTIFY. Unfortunately, LISTEN/NOTIFY doesn't work for PG Bouncer in "Transaction Mode." While relatively few users run in "Transaction Mode," it is increasingly common and deserved a work-around.

    0๏ธโƒฃ Oban.Notifier defines a minimal behaviour and Oban ships with a default implementation, Oban.PostgresNotifier, based on the old LISTEN/NOTIFY ๐Ÿ”ง module. You can specify a different notifier in your Oban configuration:

    config :my_app, Oban,
      notifier: MyApp.CustomNotifier,
      repo: MyApp.Repo,

    An alternate [pg/pg2 based notifier][pgn] is available in Oban Pro.

    Replacing Opts on Unique Conflict

    โšก๏ธ The replace_args option for updating args on unique conflict is replaced with โšก๏ธ a highly flexible replace option. Using replace, you can update any job field when there is a conflict. Replace works for any of the following fields: โฑ args, max_attempts, meta, priority, queue, scheduled_at, tags, ๐Ÿ‘ท worker.

    For example, to change the priority to 0 and increase max_attempts to 5 when there is a conflict:
      max_attempts: 5,
      priority: 0,
      replace: [:max_attempts, :priority]

    โฑ Another example is bumping the scheduled time to 1 second in the future on โฑ conflict. Either scheduled_at or schedule_in values will work, but the โฑ replace option is always scheduled_at., schedule_in: 1, replace: [:scheduled_at])

    โž• Added

    • ๐Ÿ‘ท [Oban.Job] A new conflict? field indicates whether a unique job conflicted with an existing job on insert.

    • [Oban.Telemetry] Always populate the unsaved_error field for error or discard events. Previously, the field was empty for discard events.

    • ๐Ÿ‘ท [Oban.Queue.Engine] Define a cancel_job/2 callback in the engine and move cancellation from the query module to the BasicEngine.

    ๐Ÿ”„ Changed

    • ๐Ÿ”จ [Oban.Testing] Thanks to a slight refactoring, the perform_job/3 helper now emits the same telemetry events that you'd have in production. The refactoring also exposed and fixed an inconsistency around invalid snooze handlers.

    • โœ… [Oban.Testing] Expose Testing.all_enqueued/0, an alternate clause that doesn't require any options. This new clause makes it possible to check for any enqueued jobs without filters.

    • ๐Ÿ”Œ [Oban.Plugins.Stager] Limit the number of jobs staged at one time to prevent timeout errors while staging a massive number of jobs.

    ๐Ÿ›  Fixed

    • [Oban.Repo] Respect ongoing transactions when using get_dynamic_repo. Prior to this fix, calls that use Oban.Repo, such as Oban.insert/2, could use a different repo than the one used in the current transaction.
  • v2.6.1 Changes

    April 02, 2021

    ๐Ÿ›  Fixes

    • [Oban.Drainer] Always use the BasicEngine for draining, regardless of the currently configured engine.
  • v2.6.0 Changes

    April 02, 2021

    โฌ†๏ธ ๐ŸŒŸ Web and Pro users should check the [v2.6 upgrade guide][v26ug] for a complete walkthrough.

    ๐Ÿ”Œ Pluggable Queue Engines

    Queue producers now use an "engine" callback module to manage demand and work โœจ with the database. The engine provides a clean way to expand and enhance the functionality of queue producers without modifying the solid foundation of queue supervision trees. Engines make enhanced functionality such as global concurrency, local rate limiting and global rate limiting possible!

    The BasicEngine is the default, and it retains the exact functionality of previous Oban versions. To specify the engine explicitly, or swap in an ๐Ÿ”ง alternate engine, set it in your configuration:

    config :my_app, Oban,
      engine: Oban.Queue.BasicEngine,

    โฌ†๏ธ See the [v2.6 upgrade guide][v26ug] for instructions on swapping in an alternate engine.

    Recursive Queue Draining

    The ever-handy Oban.drain_queue/1,2 function gained a new with_recursion ๐Ÿ‘ท option, which makes it possible to test jobs that insert more jobs when they execute. When with_recursion is enabled the queue will keep executing until no โฑ jobs are available. It even composes with with_scheduled!

    โœ… In practice, this is especially useful for testing dependent workflows.

    ๐Ÿ”Œ Gossip Plugin for Queue Monitoring

    ๐Ÿ”Œ The new gossip plugin uses PubSub to efficiently exchange queue state information between all interested nodes. This allows Oban instances to broadcast state information regardless of which engine they are using, and without storing anything in the database.

    โฌ†๏ธ See the [v2.6 upgrade guide][v26ug] for details on switching to the gossip ๐Ÿ”Œ plugin.

    โž• Added

    • ๐Ÿ‘ท [Oban.Job] Inject the current conf into the jobs struct as virtual field, making the complete conf available within perform/1.

    • [Oban.Notifier] Add unlisten/2, used to stop a process from receiving notifications for one or more channels.

    ๐Ÿ”„ Changed

    • [Oban.Telemetry] Stop emitting circuit events for queue producers. As producers no longer poll, the circuit breaker masked real errors more than it guarded against sporatic issues.

    • [Oban.Telemetry] Delay [:oban, :supervisor, :init] event until the complete supervision tree finishes initialization.

    • [Oban.Migration] Stop creating an oban_beats table entirely.

    ๐Ÿ›  Fixed

    • โฑ [Oban.Plugins.Cron] Prevent schedule overflow right before midnight
  • v2.5.0 Changes

    February 26, 2021

    Top of the Minute Cron

    โฑ Rather than scheduling cron evaluation 60 seconds after the server starts, โฑ evaluation is now scheduled at the top of the next minute. This yields several ๐Ÿ‘Œ improvements:

    • ๐Ÿ‘ท More predictable timing for cron jobs now that they are inserted at the top of the minute. Note that jobs may execute later depending on how busy queues are.
    • ๐Ÿ‘ท Minimize contention between servers inserting jobs, thanks to the transaction lock acquired by each plugin.
    • ๐Ÿ‘ท Prevent duplicate inserts for jobs that omit the completed state (when server start time is staggered the transaction lock has no effect)

    ๐Ÿ”Œ Repeater Plugin for Transaction Pooled Databases

    Environments that can't make use of PG notifications, i.e. because they use ๐Ÿ‘ท PgBouncer with transaction pooling, won't process available jobs reliably. The ๐Ÿ†• new Repeater plugin provides a workaround that simulates polling functionality for producers.

    ๐Ÿ”Œ Simply include the Repeater in your plugin list:

    config :my_app, Oban,
      plugins: [

    ๐Ÿ“‡ Include Perform Result in Job Telemetry Metadata

    ๐Ÿ“‡ The metadata for [:oban, :job, :stop] telemetry events now include the job's ๐Ÿ‘ท perform/1 return value. That makes it possible to extract job output from other processes:

    def handle_event([:oban, :job, :stop], _timing, meta, _opts) do
      IO.inspect(meta.result, label: "return from #{meta.job.worker}")

    โž• Added

    • ๐Ÿ‘ [Oban] Support a changeset function in addition to a changeset in insert_all/4. Inserting jobs within a multi is even more powerful.

    • ๐Ÿ‘ท [Oban.Queue.Executor] Stash a timed job's pid to enable inner process messaging, notably via telemetry events.

    ๐Ÿ”„ Changed

    • โฌ†๏ธ [Oban] Upgrade minimum Elixir version from 1.8 to 1.9.

    • ๐Ÿ”Œ [Oban.Plugins.Cron] Individually validate crontab workers and options, providing more descriptive errors at the collection and entry level.

    • ๐Ÿ‘ท [Oban] Simplify the job cancelling flow for consistency. Due to race conditions it was always possible for a job to complete before it was cancelled, now that flow is much simpler.

    • [Oban.Queue.Producer] Replace dispatch cooldown with a simpler debounce mechanism.

    • ๐Ÿ”Œ [Oban.Plugins.Stager] Limit the number of notify events to one per queue, rather than one per available job.

    ๐Ÿ›  Fixed

    • [Oban.Queue.Producer] Handle unclean exits without an error and stack, which prevents "zombie" jobs. This would occur after multiple hot upgrades when the worker module changed, as the VM would forcibly terminate any processes running the old modules.

    • [Oban] Specify that the changeset_wrapper type allows keys other than :changesets, fixing a dialyzer type mismatch.

    โœ‚ Removed

    • ๐Ÿšš [Oban] Remove the undocumented version/0 function in favor of using the standard Application.spec/2
  • v2.4.3 Changes

    February 07, 2021

    ๐Ÿ›  Fixed

    • ๐Ÿ‘ท [Oban.Telemetry] Use conf rather than config in meta for :job and :circuit telemetry events.
  • v2.4.2 Changes

    January 28, 2021

    ๐Ÿ›  Fixed

    • ๐Ÿ”Œ [Oban.Plugins.Stager] Notify queues of all available jobs, not only jobs that were most recently staged. In some circumstances, such as reboot or retries, jobs are available without previously being scheduled.
  • v2.4.1 Changes

    January 27, 2021

    ๐Ÿ›  Fixed

    • [Oban.Migrations] Correctly migrate up between sequential versions. The V10 migration adds check constraints, which can't be re-run safely. An attempted work-around prevented re-runs, but broke sequential upgrades like 9->10.

    • [Oban.Queue.Producer] Kick off an initial dispatch to start processing available jobs on startup, to compensate for a lack of incoming jobs or scheduling.

    • โฑ [Oban.Plugins.Stager] Keep rescheduling staging messages after the initial run.

  • v2.4.0 Changes

    January 26, 2021

    ๐Ÿ”Œ Centralized Stager Plugin

    โฑ Queue producers no longer poll every second to stage scheduled jobs. Instead, ๐Ÿ”Œ the new Oban.Plugins.Stager plugin efficiently handles staging from a single location. This reduces overall load on the BEAM and PostgreSQL, allowing apps to easily run hundreds of queues simultaneously with little additional overhead.

    In a test with a single Ecto connection and 512 queues the CPU load went from 60.0% BEAM / 21.5% PostgreSQL in v2.3.4 to 0.5% BEAM / 0.0% PostgreSQL.

    ๐Ÿ”Œ The stager plugin is automatically injected into Oban instances and there isn't ๐Ÿ”ง any additional configuration necessary. However, if you've set a poll_interval ๐Ÿšš for Oban or an individual queue you can safely remove it.

    Overhauled Cron

    The CRON parser is entirely rewritten to be simpler and dramatically smaller. ๐Ÿ“œ The previous parser was built on nimble_parsec and while it was fast, the ๐Ÿ“œ compiled parser added ~5,500LOC to the code base. Thanks to a suite of property โœ… tests we can be confident that the new parser behaves identically to the ๐Ÿ“œ previous one, and has much clearer error messages when parsing fails.

    ๐Ÿ“œ Along with a new parser the crontab functionality is extracted into the ๐Ÿ”Œ Oban.Plugins.Cron plugin. For backward compatibility, top-level crontab and ๐Ÿ”Œ timezone options are transformed into a plugin declaration. If you'd like to ๐Ÿ”ง start configuring the plugin directly change your config from:

    config :my_app, Oban,
      crontab: [{"* * * * *", MyApp.Worker}],
      timezone: "America/Chicago"

    To this:

    config :my_app, Oban,
      plugins: [
         crontab: [{"* * * * *", MyApp.Worker}],
         timezone: "America/Chicago"}

    ๐Ÿ”Œ The plugin brings a cleaner implementation, simplified supervision tree, and ๐Ÿ”ง eliminates the need to set crontab: false in test configuration.

    ๐Ÿ‘Œ Improved Indexes for Unique Jobs

    ๐Ÿ‘ท Applications may have thousands to millions of completed jobs in storage. As the ๐ŸŽ table grows the performance of inserting unique jobs can slow drastically. A new V10 migration adds necessary indexes, and paired with improved query logic it alleviates insert slowdown entirely.

    ๐Ÿ‘ท For comparison, a local benchmark showed that in v2.3.4 inserting a unique job ๐Ÿ‘ท into a table of 1 million jobs runs around 4.81 IPS. In v2.4.0 it runs at 925.34 IPS, nearly 200x faster.

    The V10 migration is optional. If you decide to migrate, first create a new migration:

    mix ecto.gen.migration upgrade_oban_jobs_to_v10

    Next, call Oban.Migrations in the generated migration:

    defmodule MyApp.Repo.Migrations.UpdateObanJobsToV10 do
      use Ecto.Migration
      def up do
        Oban.Migrations.up(version: 10)
      def down do
        Oban.Migrations.down(version: 10)

    โž• Added

    • [Oban] Add [:oban, :supervisor, :init] event emitted when an Oban supervisor starts.

    • ๐Ÿ”Œ [Oban.Telemetry] Wrap built-in plugins with telemetry spans and consistently include conf in all telemetry events.

    • [Oban.Config] Improve the error messages raised during initial validation. Also, the Config module is now public with light documentation.

    • โœ… [Oban.Testing] Support specifying a default prefix for all test assertions. This comes with improved assertion messages that now include the prefix.

    • [Oban.Repo] Add delete/3 as a convenient wrapper around c:Ecto.Repo.delete/2.

    • ๐Ÿ‘ท [Oban.Job] New check constraints prevent inserting jobs with an invalid priority, negative max_attempts or an attempt number beyond the maximum.

    ๐Ÿ”„ Changed

    • ๐Ÿ—„ [Oban.Telemetry] Deprecate and replace span/3 usage in favor of the official :telemetry.span/3, which wasn't available when span/3 was implemented.

    ๐Ÿ›  Fixed

    • [Oban] Inspect the error reason for a failed insert!/2 call before it is raised as an error. When insert!/2 was called in a transaction the error could be :rollback, which wasn't a valid error.