mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
13cb5b78a8
- ### Problem If we use `perform_enqueued_jobs` without a block, a job that raises an error wouldn't be appended to the list of `performed_jobs`. ### Solution Push the job in the array before it is actually performed.
11 lines
221 B
Ruby
11 lines
221 B
Ruby
# frozen_string_literal: true
|
|
|
|
class RaisingJob < ActiveJob::Base
|
|
MyError = Class.new(StandardError)
|
|
|
|
retry_on(MyError, attempts: 2)
|
|
|
|
def perform(error = "RaisingJob::MyError")
|
|
raise error.constantize
|
|
end
|
|
end
|