[Backgroundrb-devel] backgroundrb preview

skaar
2006-11-06T01:21:40Z

* skaar (skaar at waste.org) [061104 21:38]:
> >     worker.read_from_socket  ##### interesting line #666
> >
> > now..on #666, how do i make sure..that controller just triggers the
> > method in worker and control comes back to the controller immediately.
> > Sounds like a typical use case of threads.
>
> it''s not yet documented, but used internally for do_work, but you
could
> call:
>
>    worker.work_thread(:method => :read_from_socket)
>
> which will run the method in a separate thread in the worker process. (I
> would have to werify how work_thread behaves without arguments, but we
> can deal with that - please submit a ticket if you find that it
doesn''t
> work).

ok, the above will in 0.2.1 (and from trunk r142) work as adverticed,
you can use work_thread to background in the worker any method, with or
without arguments.

For now you will have to device a way in the worker to determine when
the method is done doing it''s work.

Worker exceptions are logged in backgroundrb.log. There is currently
little indication in the MiddleMan if an exception has occured in the
worker, but in the case an exception occur, the worker will be deleted.

/skaar



--
----------------------------------------------------------------------
|\|\             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
----------------------------------------------------------------------