Permalink
Browse files

added ability to disable persistent/enqueued system, or change its pr…

…ocessing delay
  • Loading branch information...
1 parent 1bbdf31 commit 9785d99939f4391e11f2b807ba153cd1a4ad07c0 Kieran Pilkington committed Aug 14, 2008
Showing with 7 additions and 1 deletion.
  1. +2 −0 doc/content/content.txt
  2. +2 −0 examples/backgroundrb.yml
  3. +3 −1 server/lib/meta_worker.rb
View
2 doc/content/content.txt
@@ -91,6 +91,8 @@ Following file demonstrates other available configuration options:
:environment: production # rails environment to load
:log: foreground # foreground mode,print log messages on console
:debug_log: false # disable log workers and other logging
+ :persistent_disabled: false # turn this off if your application doesn't use backgroundrb's persistent/enqueued tasks system
+ :persistent_delay: 10 # the time (seconds) between each time backgroundrb checks the database for enqueued tasks
:schedules: # optional task scheduling
: # look in scheduling section </pre>
View
2 examples/backgroundrb.yml
@@ -7,6 +7,8 @@
:debug_log: true # whether to print debug logs to a seperate worker, defaults to true
:log: foreground # will print log messages to STDOUT, defaults to seperate log worker
:result_storage: memcache # store results in a mecache cluster, you also need to specify location of your memcache clusters in next section
+ :persistent_disabled: false # turn this off if your application doesn't use backgroundrb's persistent/enqueued tasks system
+ :persistent_delay: 10 # the time (seconds) between each time backgroundrb checks the database for enqueued tasks
:memcache: "10.0.0.1:11211,10.0.0.2:11211" #=> location of mecache clusters seperated by comma
View
4 server/lib/meta_worker.rb
@@ -133,7 +133,9 @@ def worker_init
create_arity = method(:create).arity
(create_arity == 0) ? create : create(worker_options[:data])
end
- add_periodic_timer(5) { check_for_enqueued_tasks }
+ return if BDRB_CONFIG[:backgroundrb][:persistent_disabled]
+ delay = BDRB_CONFIG[:backgroundrb][:persistent_delay] || 5
+ add_periodic_timer(delay.to_i) { check_for_enqueued_tasks }
end
# return job key from thread global variable

0 comments on commit 9785d99

Please sign in to comment.