[Backgroundrb-devel] 1.0.3 problems with script/start

Ryan Leavengood leavengood at gmail.com
Mon Mar 3 12:28:55 EST 2008

On Mon, Mar 3, 2008 at 12:08 PM, Clint Troxel <clint at ctro.net> wrote:
>  ctro$ script/backgroundrb start
>  (erb):11: undefined method `seconds' for 5:Fixnum (NoMethodError)
>  ---------------------------------------------------------------------------------------------------
>  Is this not the correct way to schedule the worker?

You are getting that error because the 5.seconds and 2.years methods
are not by default in Ruby, they are added by classes in Rails. It
seems the Rails code and environment is not loaded at the time the
backgroundrb.yml file is loaded.

Since the above syntax is shown on the BackgrounDRb documentation, I
can only assume this is a bug.

The simple solution for the time being is to just "expand" those
values using the Rails console:

Loading development environment.
>> 5.seconds
=> 5
>> 2.years
=> 63115200
>> 1.day
=> 86400

Then use those expanded values in the backgroundrb.yml file.

>  Also, a slightly related question:  how does the add_periodic_timer
>  method work?  Is it started up "automatically" like workers used to be
>  in the example above?

If you put a call to add_periodic_timer in your create method for
workers loaded automatically (which is all workers by default), then
yes the periodic timer will be set up automatically.


More information about the Backgroundrb-devel mailing list