Kenichi Sugihara
2006-Dec-13 07:54 UTC
[Backgroundrb-devel] Unintended thread forked in autostart
Hello all,
I''ve got the problem about the following simple application using
autostart and repeat_every.
A thread(?) is forked for processing task at first, but at sencond time
two threads seem to be forked.
My simple application code is...
- In worker class
class FooWorker < BackgrounDRb:Rails
repeat_every 2.minutes
first_run Time.now
def do_work
puts Time.now.to_s + "Start processing....."
do_some_task()
puts Time.now.to_s + "Finish processing"
end
- In background.yml
autostart:
1:
class: foo_worker
arg: ''''
Result is....
--- First time---
Start processing
Finish processing
--- Second time ---
Start processing
Start processing
Finish processing
Finish processing
regards.
--
--------------------------------------
Kenichi Sugihara
--------------------------------------
Ezra Zygmuntowicz
2006-Dec-13 18:47 UTC
[Backgroundrb-devel] Unintended thread forked in autostart
On Dec 12, 2006, at 11:54 PM, Kenichi Sugihara wrote:> > Hello all, > > I''ve got the problem about the following simple application using > autostart and repeat_every. > > A thread(?) is forked for processing task at first, but at sencond > time > two threads seem to be forked. > > My simple application code is... > > - In worker class > class FooWorker < BackgrounDRb:Rails > repeat_every 2.minutes > first_run Time.now > > def do_work > puts Time.now.to_s + "Start processing....." > do_some_task() > puts Time.now.to_s + "Finish processing" > end > > - In background.yml > > autostart: > 1: > class: foo_worker > arg: '''' > > Result is.... > --- First time--- > Start processing > Finish processing > > --- Second time --- > Start processing > Start processing > Finish processing > Finish processing > > regardsHey There- The older version of backgroundrb had a problem with the repeat_every directive. SO it doesn''t work as expected. If you really need the timing functionality I suggest you upgrade to the 0.2.1 version of the plugin. You can get it here. http://svn.devjavu.com/backgroundrb/tags/release-0.2.1/ http://svn.devjavu.com/backgroundrb/tags/release-0.2.1/README Cheers- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez at engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)
Is the latest release of the new code production ready? I''m finally working seriously on deploying workers in our site and right now we''re on the old branch. -- Joshua Warchol Code Poet, Zaadz Inc. http://joshua.zaadz.com/
On Dec 13, 2006, at 10:55 AM, Joshua Warchol wrote:> Is the latest release of the new code production ready? I''m finally > working seriously on deploying workers in our site and right now we''re > on the old branch. > > -- > Joshua Warchol > Code Poet, Zaadz Inc. > http://joshua.zaadz.com/ >Hey Josh- I guess that depends on what kind of workers you are using. If the old plugin is working for you then there may not be a good reason right now to upgrade. There are many production sites still running the old version perfectly well. So tell me a bit about what you are using it for? If its lighter weight duty then the old branch is great. If it requires a ton of processing power then the new multi process model might be better. Thanks -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez at engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)
Ezra Zygmuntowicz wrote:> So tell me a bit about what you are using it for? If its lighter > weight duty then the old branch is great. If it requires a ton of > processing power then the new multi process model might be better.Well, basically the key worker in this situation is going to be creating delivery records in a "notifications" table as part of sending newsletters. So it''s a long running (1-10 minutes) job of creating thousands of rows in the table. I think it can be done just fine in the older code, so I''m probably going to stick there and cheer on the new code from the sideline for a bit. I have played with the new hotness a bit and it''s looking great. Josh -- Joshua Warchol Code Poet, Zaadz Inc. http://joshua.zaadz.com/