[Backgroundrb-devel] {worker} after :end-time worker freaks out

Matthias Heigl m.heigl at gmx.net
Sun Jan 13 13:21:05 EST 2008


Hi all,

i was using bdrb a while ago and it wasn't stable enough in version 
0.2.1 for doing the job - it loss jobs or did execute only the first one 
invoked and so on.

Now i gave the new version a try and i found a bug at playing around.

When i start a worker_method over the normal Unix scheduler bdrb will 
start as much as possible the worker_method after the :end-time is reached.

I verifyed the behavior on two different boxes:

1. Mac OS X 10.5.1

2. Debian Lenny

Both using Rub 1.8.6 an backgroundrb 1.0.

My Test-Files

backgroundrb.yml
- - - - - -
:backgroundrb:
   :port: 11006
   :ip: localhost
   :environment: development
:schedules:
   :mytest_worker:
     :doit:
       :trigger_args:
         :start: <%= Time.now + 1.seconds %>
         :end: <%= Time.now + 1.minute %>
         :repeat_interval: <%= 10.seconds %>
- - - - - -

mytest_worker.rb
- - - - - -
class MytestWorker < BackgrounDRb::MetaWorker
   set_worker_name :mytest_worker
   def create(args = nil)
     # this method is called, when worker is loaded for the first time
     @counter=0
   end
   def doit
     @counter += 1
     logger.debug("mytest: doit #{@counter} - #{Time.now}")
   end
end
- - - - - -

After i start bdrb with ./script/backgroundrb start my backgroundrb.log 
looks like this:
- - - - - -
mytest_worker started
Schedules for worker loaded
mytest: doit 1 - Sun Jan 13 19:07:19 +0100 2008
mytest: doit 2 - Sun Jan 13 19:07:29 +0100 2008
mytest: doit 3 - Sun Jan 13 19:07:39 +0100 2008
mytest: doit 4 - Sun Jan 13 19:07:49 +0100 2008
mytest: doit 5 - Sun Jan 13 19:07:59 +0100 2008
mytest: doit 6 - Sun Jan 13 19:08:09 +0100 2008
mytest: doit 7 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 8 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 9 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 10 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 11 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 12 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 13 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 14 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 15 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 16 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 17 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 18 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 19 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 20 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 21 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 22 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 23 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 24 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 25 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 26 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 27 - Sun Jan 13 19:08:19 +0100 2008
mytest: doit 28 - Sun Jan 13 19:08:19 +0100 2008
... (about 180 per second)
- - - - - -

For my projekt i didn't need the Unix scheduler style, but while testing 
if the new version will meet the requirements i noticed this.

Maybe i did something wrong, but in the version 0.2.1 the :end-time 
works - i think.

My Question about best practise will be part of my next mail to keep 
apart the issues.

Cheers,

Matze


More information about the Backgroundrb-devel mailing list