tom roth
2006-Dec-05 14:00 UTC
[Backgroundrb-devel] worker method not running in background
When i call a worker method my browsers hangs until the task is finished. The same code works nicely in the background when inside the do_work method. Does this mean i can only start a task in background via the do_work method ? Or am i doing something wrong here ? regards tom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20061205/43bae8ef/attachment.html
Jason Sydes
2006-Dec-05 18:13 UTC
[Backgroundrb-devel] worker method not running in background
On 12/5/06, tom roth <rawdlite at googlemail.com> wrote:> > When i call a worker method my browsers hangs until the task is finished. > The same code works nicely in the background when inside the do_work method. > Does this mean i can only start a task in background via the do_work > method ? > Or am i doing something wrong here ?Hi Tom, You need to call your_method() via work_thread() so that your_method is wrapped in a (background) ruby thread. Something like: your_worker.work_thread(:method => :your_method) or maybe your_worker.work_thread(:method => :your_method, :args => some_args) If you try calling do_work directly (instead of via new_worker()) I''d expect your browser to hang as well. Hope that helps, Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20061205/d92e38f3/attachment.html