Martin May
2006-Aug-29 01:21 UTC
[Backgroundrb-devel] Tasks get executed twice with repeat_every
I have a simple worker that I set up with repeat_every: class DueNoteQueuerWorker < BackgrounDRb::Rails repeat_every 1.minutes first_run Time.now def do_work(args) @logger.debug("Sending due notes. The current time is #{Time.now}") end end I want this to run every minute, all the time. The first run is fine, but it seems that subsequent runs get executed twice. From the logfile: # Logfile created on Mon Aug 28 19:18:01 MDT 2006 by logger.rb/1.5.2.7 Sending due notes. The current time is Mon Aug 28 19:18:03 MDT 2006 Sending due notes. The current time is Mon Aug 28 19:19:03 MDT 2006 Sending due notes. The current time is Mon Aug 28 19:19:03 MDT 2006 Sending due notes. The current time is Mon Aug 28 19:20:03 MDT 2006 Sending due notes. The current time is Mon Aug 28 19:20:03 MDT 2006 Is there any way to fix that? Here is my configuration file: --- port: "22222" timer_sleep: 60 load_rails: true environment: development host: localhost database_yml: config/database.yml acl: deny: all allow: localhost 127.0.0.1 order: deny,allow autostart: 1: job_key: due_note_queuer1 class: due_note_queuer_worker Thanks, Martin
Ezra Zygmuntowicz
2006-Aug-29 18:40 UTC
[Backgroundrb-devel] Tasks get executed twice with repeat_every
Hi~ On Aug 28, 2006, at 6:21 PM, Martin May wrote:> > I have a simple worker that I set up with repeat_every: > > class DueNoteQueuerWorker < BackgrounDRb::Rails > > repeat_every 1.minutes > first_run Time.now > > def do_work(args) > @logger.debug("Sending due notes. The current time is # > {Time.now}") > end > > end > > > I want this to run every minute, all the time. The first run is fine, > but it seems that subsequent runs get executed twice. From the > logfile: > > # Logfile created on Mon Aug 28 19:18:01 MDT 2006 by logger.rb/1.5.2.7 > Sending due notes. The current time is Mon Aug 28 19:18:03 MDT 2006 > Sending due notes. The current time is Mon Aug 28 19:19:03 MDT 2006 > Sending due notes. The current time is Mon Aug 28 19:19:03 MDT 2006 > Sending due notes. The current time is Mon Aug 28 19:20:03 MDT 2006 > Sending due notes. The current time is Mon Aug 28 19:20:03 MDT 2006 > > Is there any way to fix that? Here is my configuration file: > > --- > port: "22222" > timer_sleep: 60 > load_rails: true > environment: development > host: localhost > database_yml: config/database.yml > acl: > deny: all > allow: localhost 127.0.0.1 > order: deny,allow > autostart: > 1: > job_key: due_note_queuer1 > class: due_note_queuer_worker > > Thanks, > MartinHey Martin- I am working on rewriting the timing mechanism for cron like workers. I had one other person report a similar issue when one worker is still running and the next one kicks off. So for now you can either try to patch it yourself or wait a bit longer until the next release. Cheers- -Ezra