Jochen Kaechelin
2008-Nov-30 19:05 UTC
[Backgroundrb-devel] Problem with scheduled Task - gets executed several times
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
Jeremy Chatfield
2008-Dec-01 07:35 UTC
[Backgroundrb-devel] Problem with scheduled Task - gets executed several times
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
hemant
2008-Dec-02 17:17 UTC
[Backgroundrb-devel] Problem with scheduled Task - gets executed several times
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?