oban v2.3.0 Release Notes

Release Date: 2020-11-06 // over 3 years ago
  • Migration Required (V9)

    ๐Ÿ‘ท Migration V9 brings the new cancelled state, a cancelled_at column, and job meta.

    Older versions of PostgreSQL, prior to version 12, don't allow altering an enum within a transaction. If you're running an older version and want to prevent a table rewrite you can add the new cancelled at state before running the V9 migration.

    Create a migration with @disable_ddl_transaction true declared and run the ๐Ÿ‘ท command ALTER TYPE oban_job_state ADD VALUE IF NOT EXISTS 'cancelled'. The V9 ๐Ÿ‘€ migration will see that the cancelled value exists and won't attempt to modify the enum.

    After you've sorted adding the cancelled state (or ignored the issue, because ๐Ÿ‘ท you're either running PG >= 12 or don't have many jobs retained), generate a new migration:

    mix ecto.gen.migration upgrade_oban_jobs_to_v9
    

    Next, call Oban.Migrations in the generated migration:

    defmodule MyApp.Repo.Migrations.UpdateObanJobsToV9 do
      use Ecto.Migration
    
      def up do
        Oban.Migrations.up(version: 9)
      end
    
      def down do
        Oban.Migrations.down(version: 9)
      end
    end
    

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

    โž• Added

    • ๐Ÿ‘ท [Oban.Job] Add new meta field for storing arbitrary job data that isn't appropriate as args.

    • ๐Ÿ‘ท [Oban.Job] Introduce a cancelled state, along with a new cancelled_at timestamp field. Cancelling a job via Oban.cancel_job (or via Oban Web) now marks the job as cancelled rather than discarded.

    • ๐Ÿ‘ท [Oban.Worker] Add from_string/1 for improved worker module resolution.

    • ๐Ÿ“‡ [Oban.Telemetry] Pass the full job schema in telemetry metadata, not only select fields. Individual fields such as args, worker, etc. are still passed for backward compatibility. However, their use is deprecated and they are no longer documented.

    ๐Ÿ›  Fixed

    • [Oban.Notifier] Fix resolution of Oban.Notifier child process in Oban.Notifier.listen/2.

    • ๐Ÿ‘ท [Oban.Queue.Producer] Fix cancelling jobs without a supervised process. In some circumstances, namely a hot code upgrade, the job's process could terminate without the producer tracking it and leave the job un-killable.

    • [Oban] Only convert invalid changesets into ChangesetError from insert!. This prevents unexpected errors when insert! is called within a transaction after the transaction has rolled back.