[Backgroundrb-devel] Handling exceptions

Aaron Pfeifer aaron.pfeifer at gmail.com
Wed Jun 4 17:57:44 EDT 2008

Is there a convention for handling exceptions within BackgrounDRb workers?
For example, I have a worker which does some asynchronous data processing
(*not* a scheduled worker) based on some things in the database.  However,
if an exception is raised within that worker, then the process for that
worker is killed off.  Ideally I would want that worker to just silently
fail and be optimistic that it was an edge case that won't happen every time
the worker is invoked.

As of now, I've just added some basic exception handling to log the error
for future inspection like so:

class EmailWorker < BackgrounDRb::MetaWorker
  set_worker_name :email_worker

  def run(data = nil)
  rescue Exception => ex
    logger.info ex

Is this generally the practice for doing exception handling within workers
or is there another approach?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080604/14054adf/attachment-0001.html>

More information about the Backgroundrb-devel mailing list