[Backgroundrb-devel] worker starting twice

skaar skaar at waste.org
Wed Mar 14 19:58:26 EDT 2007

* Jack Nutting (jnutting at gmail.com) [070314 16:26]:
> On 3/14/07, Mason Hale <masonhale at gmail.com> wrote:
> > My understanding is that for scheduled workers, the do_work method is called
> > automatically when the worker is created (which provides an opportunity for
> > any initialization, if necessary), and subsequently the :worker_method
> > specified in the backgroundrb_schedules.yml file is called on the specified
> > schedule.
> >
> > If your worker_method is specified as :do_work, then your :do_work method
> > will be called twice, once when the worker is created, and again when the
> > schedule is invoked. Note that these separate calls can occur in separate
> > threads. So if you do use the call to do_work at creation time to do some
> > initialization, you will need to set a flag internally to let other
> > (potentially simultaneous) calls to your :worker_method behave appropriately
> > if called be initialization is complete.

there is some safeguards in the code against this. If a worker is
created, then it will keep track of the fact that it's the initial
do_work and _not_ call do_work a second time on the initial schedule.


|\|\             where in the       |          s_u_b_s_t_r_u_c_t_i_o_n 
| | >===========  W.A.S.T.E.        |                  genarratologies 
|/|/    (_)     is the wisdom       |                  skaar at waste.org

More information about the Backgroundrb-devel mailing list