Retry
Retry Mechanism
When jobs fail, it’s essential to have a mechanism that ensures they are retried automatically. JoobQ provides configurable retry logic to help you handle transient errors and temporary failures.
Configuring Retries
You can configure the retry behavior globally or per job. By default, each job is retried three times, but you can change this setting to suit your application’s needs:
JoobQ.configure do |config|
config.retries = 5
end
You can also set retries for individual jobs:
class RetryJob
include JoobQ::Job
@retries = 10 # This job will retry up to 10 times
def perform
puts "Performing a job that may need retries"
raise "Simulated failure" if some_condition_fails
end
end
Last updated
Was this helpful?