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.
12 lines
221 B
Ruby
12 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
|