Skip to content

v0.3.0

Latest
Compare
Choose a tag to compare
@kaspth kaspth released this 04 Nov 18:48
· 7 commits to main since this release
10e17dd

What's Changed

  • Active Record: automatic bulk method by @kaspth in #5

On Rails 7.1, performs will also generate a _bulk class method to push jobs to the queue in bulk using the new ActiveJob.perform_all_later method under the hood.

It's handy for the cases where you scheduling a bunch of jobs in something like a cronjob. Like scheduling invoice reminders:

class Invoice < ApplicationRecord
  scope :overdue, -> { where(due_on: ..Date.today, status: "open") }

  # We can run Invoice.schedule_reminders from our crontab.
  # We're using `in_batches` so we only push 100 jobs to our queue at a time.
  def self.schedule_reminders = overdue.in_batches(of: 100).each(&:deliver_reminder_later_bulk)

  # Now also adds `deliver_reminder_later_bulk` class method that uses Rails 7.1's `ActiveJob.perform_all_later`
  performs :deliver_reminder
  def deliver_reminder
    transaction do
      Mailer.reminder(self).deliver_later
      touch! :reminded_at
    end
  end
end
  • Fix private performs marking on immediate version too by @kaspth in #6

Full Changelog: v0.2.0...v0.3.0