[Backgroundrb-devel] First call to worker method doesn't work

Dylan Markow dmarkow at gmail.com
Thu Apr 3 23:57:09 EDT 2008


I have a worker as follows:

class SampleWorker < BackgrounDRb::MetaWorker
  set_worker_name :sample_worker
  def create(args = nil)
    # this method is called, when worker is loaded for the first time
  end

  def my_method
    # Deliver test e-mail message
    Notifications.deliver_message(1, "DM")
  end
end

I have a rails controller that calls the following code:

    worker = MiddleMan.worker(:sample_worker)
    worker.my_method

The problem is that the first time I load up the page for this action,
the worker method "my_method" doesn't seem to ever get called. There
is zero output from any of the backgroundrb log files. If I then
reload the page, it works fine (and continues to work fine until
backgroundrb is restarted).

This happens whether I'm in dev. or prod. mode.


More information about the Backgroundrb-devel mailing list