collectiveidea / delayed_job

Database based asynchronous priority queue system -- Extracted from Shopify
http://groups.google.com/group/delayed_job
MIT License
4.81k stars 955 forks source link

Can we set max_attempt at the Job or Queue level? [This is a question - not an issue] #1201

Open niick7 opened 5 months ago

niick7 commented 5 months ago

Hi Team,

Is there any way that we can set the max_attempt at the Job or Queue level like this:

  1. Job level:
class WelcomeMessageJob
  def perform
    ...
  end

  def max_attempts
    **any_number**
  end

  def queue_name
    'welcome_message_queue'
  end
end
  1. Queue level:
    Delayed::Worker.max_attempts = 3
    Delayed::Worker.queue_attributes = {
    welcome_message_queue: { priority: -20, max_attempts: **any_number** },
    user_sessions_queue: { priority: -15, max_attempts: **any_number** }
    }

Hope to hear from you soon,

Thanks