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

hemant gethemant at gmail.com
Tue Dec 2 12:17:01 EST 2008


On Mon, Dec 1, 2008 at 12:35 AM, 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?

Are you saying that those database queries are getting executed
several times between the 10 minute interval?


More information about the Backgroundrb-devel mailing list