ecto_job v3.1.0 Release Notes

Release Date: 2020-09-16 // almost 4 years ago
  • ๐Ÿ”– Version 3.1.0 adds

    • ๐Ÿ‘Œ support for storing jobs in MySQL 8, thanks @jeanparpaillon !
    • ๐Ÿ‘ท persisting job params as an Elixir/Erlang term, thanks @lukyanov !

    You can insert any arbitrary Elixir/Erlang term into the queue:

    {"SendEmail", "[email protected]", "Welcome!"}|\>|\> MyApp.Repo.insert()

    You should use the option :params_type when defining your queue module:

    defmodule MyJobQueue douse EctoJob.JobQueue, table\_name: "jobs", params\_type: :binary# ...end

    0๏ธโƒฃ Possible values of the option are: :map (default) and :binary (for storing Elixir/Erlang terms).

    You should use the same option when setting up the migration:

    @ecto\_job\_version 3def up doEctoJob.Migrations.Install.up() EctoJob.Migrations.up("jobs", version: @ecto\_job\_version, params\_type: :binary)end

Previous changes from v3.0.0

  • ๐Ÿ”– Version 3.0 adds support for prioritizing jobs within each job queue. ๐Ÿ‘ท The priority option can be given when creating a Job:

    %{"type" => "SendEmail", "address" => "[email protected]", "body" => "Welcome!"}
    |> 2, max_attempts: 2)
    |> MyApp.Repo.insert()

    0๏ธโƒฃ Lower numbers run first, the default value is 0.

    Thanks to ramondelemos for contibuting this feature!

    ๐Ÿ‘ท #45 - gabriel128 Failed jobs will retry before the full execution_timeout when an error occurs. By default the first retry will occur 30 seconds after failure.

    Thanks to gabriel128 for contributing this feature!

    Migrating to 3.0

    โšก๏ธ To upgrade to version 3.0 you must add a migration to update the pre-existent job queue tables:

    mix ecto.gen.migration update_job_queue
    defmodule MyApp.Repo.Migrations.UpdateJobQueue do
      use Ecto.Migration
      @ecto_job_version 3
      def up do
        EctoJob.Migrations.UpdateJobTable.up(@ecto_job_version, "jobs")
      def down do
        EctoJob.Migrations.UpdateJobTable.down(@ecto_job_version, "jobs")