[Backgroundrb-devel] Problem with scheduled Task - gets executed several times

Jochen Kaechelin gissmog at gissmog.de
Sun Nov 30 14:05:26 EST 2008


I have the following:

---
:backgroundrb:
   :port: 11006
   :ip: 0.0.0.0
   :environment: development
   :persistent_disabled: true
:schedules:
     :inventory_worker:
       :dummy:
         :trigger_args: * */10 * * * *


class InventoryWorker < BackgrounDRb::MetaWorker
   set_worker_name :inventory_worker
   # reload_on_schedule true

   def create(args = nil)
   end

   def dummy(args = nil)
     Inventory.create(:kadisnr => "10000", :inventory => 1)
   end
end


 >> MiddleMan.worker(:inventory_worker).worker_info
=> {:status=>:running, :worker=>:inventory_worker, :worker_key=>nil}


The Task getes executed after 10 minutes but the logfile will show me:

Inventory Create (0.2ms)   INSERT INTO `inventories` (`updated_at`,  
`kadisnr`, `inventory`, `created_at`) VALUES('2008-11-30 19:00:41',  
'10000', 1, '2008-11-30 19:00:41')
   SQL (0.4ms)   COMMIT
   SQL (0.1ms)   BEGIN
   Inventory Create (0.2ms)   INSERT INTO `inventories` (`updated_at`,  
`kadisnr`, `inventory`, `created_at`) VALUES('2008-11-30 19:00:42',  
'10000', 1, '2008-11-30 19:00:42')
   SQL (0.4ms)   COMMIT
   SQL (0.1ms)   BEGIN


so I get hundreds of new database entries.

Why is the dummy method executed several times? And why will it never  
stop again?

--
Jochen



More information about the Backgroundrb-devel mailing list