开发者

delayed_job daemon quitting on errors

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜