brandonhilkert / sucker_punch

Sucker Punch is a Ruby asynchronous processing library using concurrent-ruby, heavily influenced by Sidekiq and girl_friday.
MIT License
2.65k stars 114 forks source link

Is there a way to retry a failed job? #200

Closed basiszwo closed 7 years ago

basiszwo commented 7 years ago

In my application I am sending emails with sucker punch asynchronously.

Sometimes the mail server has outages which results in exceptions.

I am wondering if there is a way to somehow retry a job after a couple of seconds?

brandonhilkert commented 7 years ago

Sucker Punch doesn't provide that, but I don't think anything's stopping you from building it in to the job:


class LogJob
  include SuckerPunch::Job

  def perform(event)
    Log.new(event).track
  rescue SeverError => e
    LogJob.perform_in(2, event) # Enqueue the job for a few seconds later
  end
end
basiszwo commented 7 years ago

thank you for the quick answer and for pointing me to perform_in!

jaredbeck commented 10 months ago

Sucker Punch doesn't provide [a retry feature] .. -2017

Is this still true in 2023? Thanks for the gem!

brandonhilkert commented 10 months ago

Nothing has changed. You're welcome :)