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

Jeremy Chatfield jezchatfield at gmail.com
Mon Dec 1 02:35:48 EST 2008


In your backgroundrb.yml, you've used an asterisk for the seconds-  
that means 'run every second'.

Not sure why it doesn't stop.

On 30 Nov 2008, at 19:05, Jochen Kaechelin <gissmog at gissmog.de> wrote:

> 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
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel


More information about the Backgroundrb-devel mailing list