开发者

delayed_job daemon quitting on errors

开发者 https://www.devze.com 2023-02-17 20:50 出处:网络
I\'m running the delayed_job daemon using daemon-spawn gem, however, whenever there is a database locked error or any other type of error for that matter, the delayed_job daemon stops/quits.Is there a

I'm running the delayed_job daemon using daemon-spawn gem, however, whenever there is a database locked error or any other type of error for that matter, the delayed_job daemon stops/quits. Is there any way to rescue these exceptions in the dae开发者_运维问答mon?


I suppose it's no code, no answer :)

Depending on your setup you can rescue errors:

class CrawlJob

  attr_accessor :site_id

  def initialize(site_id)
    self.site_id = site_id
  end

  def perform
    begin
      Site.find(self.site_id).crawl
    rescue
      # ... handle the error
    end
  end

end
0

精彩评论

暂无评论...
验证码 换一张
取 消