oban v1.0.0-rc.1 Release Notes

Release Date: 2020-01-21 // over 4 years ago
  • Migration Required (V8)

    ๐Ÿš€ This is the first required migration since 0.8.0, released in 09/2019. It brings ๐Ÿ‘ท with it a new column, discarded_at, a streamlined notifications trigger, job ๐Ÿ‘ท prioritiy and job tags.

    โฌ†๏ธ Upgrading only requires running the new migration.

    First, generate a new migration:

    mix ecto.gen.migration upgrade_oban_jobs_to_v8
    

    Next, call Oban.Migrations in the generated migration:

    defmodule MyApp.Repo.Migrations.UpdateObanJobsToV8 do
      use Ecto.Migration
    
      def up, do: Oban.Migrations.up(version: 8)
      def down, do: Oban.Migrations.down()
    end
    

    โฌ†๏ธ Oban will manage upgrading to V8 regardless of the version your application is currently using, and it will roll back a single version.

    โž• Added

    • โฑ [Oban] Add timezone support for scheduling cronjobs using timezones other than "Etc/UTC". Using a custom timezone requires a timezone database such as tzdata.

    • ๐Ÿ”ง [Oban] Add dispatch_cooldown option to configure the minimum time between a producer fetching more jobs to execute.

    • ๐Ÿ”ง [Oban] Add beats_maxage option to configure how long heartbeat rows are retained in the oban_beats table. Each queue generates one row per second, so rows may accumulate quickly. The default value is now five minutes, down from one hour previously.

    • ๐Ÿ‘ท [Oban.Job] Add discarded_at timestamp to help identify jobs that were discarded and not completed. The timestamp is added by the V8 migration and it is also included in the original create table from V1 as a minor space saving optimization (packing datetime columns together because they use a predictable 4bytes of space).

    • ๐Ÿ‘ท [Oban.Job] Add numerical priority value to control the order of execution for jobs within a queue. The priority can be set between 0 and 3, with 0 being the default and the highest priority.

    • ๐Ÿ‘ท [Oban.Job] Add tags field for arbitrarily organizing associated tags. Tags are a list of strings stored as an array in the database, making them easy to search and filter by.

    ๐Ÿ”„ Changed

    • 0๏ธโƒฃ [Oban] Change the default prune value from :disabled to {:maxlen, 1_000}. Many people don't change the default until they realize that a lot of jobs are lingering in the database. It is rare that anybody would want to keep all of their jobs forever, so a conservative default is better than :disabled.

    • [Oban] Change oban_beats retention from one hour to five minutes. The value is now configurable, with a default of 300s. The lower bound is 60s because we require one minute of heartbeat activity to rescue orphaned jobs.

    • [Oban.Queue.Producer] Introduce "dispatch cooldown" as a way to debounce repeatedly fetching new jobs. Repeated fetching floods the producer's message queue and forces the producer to repeatedly fetch one job at a time, which is not especially efficient. Debounced fetching is much more efficient for the producer and the database, increasing maximum jobs/sec throughput so that it scales linearly with a queue's concurrency settings (up to what the database can handle).

    • ๐Ÿ‘ท [Oban.Query] Discard jobs that have exhausted the maximum attempts rather than rescuing them. This prevents repeatedly attempting a job that has consistently crashed the BEAM.

    • [Oban.Query] Use transactional locks to prevent duplicate inserts without relying on unique constraints in the database. This provides strong unique guarantees without requiring migrations.

    โœ‚ Removed

    • [Oban.Notifications] An overhauled and simplified insert trigger no longer emits update notifications. This was largely an internal implementation detail and wasn't publicly documented, but it does effect the UI.