Class: Backburner::Configuration
- Inherits:
-
Object
- Object
- Backburner::Configuration
- Defined in:
- lib/backburner/configuration.rb
Constant Summary collapse
- PRIORITY_LABELS =
{ :high => 0, :medium => 5, :low => 9 }
Instance Attribute Summary collapse
-
#allq_url ⇒ Object
beanstalk url connection.
-
#default_priority ⇒ Object
default job priority.
-
#default_queues ⇒ Object
default queues.
-
#default_worker ⇒ Object
default worker class.
-
#job_parser_proc ⇒ Object
proc to parse a job body from a string.
-
#job_serializer_proc ⇒ Object
proc to write the job body to a string.
-
#logger ⇒ Object
logger.
-
#max_job_retries ⇒ Object
max job retries.
-
#namespace_separator ⇒ Object
namespace separator.
-
#on_error ⇒ Object
error handler.
-
#primary_queue ⇒ Object
the general queue.
-
#priority_labels ⇒ Object
priority labels.
-
#reserve_timeout ⇒ Object
duration to wait to reserve on a single server.
-
#respond_timeout ⇒ Object
default job timeout.
-
#retry_delay ⇒ Object
(minimum) retry delay in seconds.
-
#retry_delay_proc ⇒ Object
proc to calculate delay (and allow for back-off).
-
#tube_namespace ⇒ Object
namespace prefix for every queue.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/backburner/configuration.rb', line 23 def initialize @allq_url = "allq://127.0.0.1:8090" @tube_namespace = "backburner" @namespace_separator = "." @default_priority = 5 @respond_timeout = 120 @on_error = nil @max_job_retries = 1 @retry_delay = 5 @retry_delay_proc = lambda { |min_retry_delay, num_retries| min_retry_delay + (num_retries ** 3) } @default_queues = [] @logger = nil @default_worker = Backburner::Workers::Simple @primary_queue = "backburner-jobs" @priority_labels = PRIORITY_LABELS @reserve_timeout = nil @job_serializer_proc = lambda { |body| body.to_json } @job_parser_proc = lambda { |body| JSON.parse(body) } end |
Instance Attribute Details
#allq_url ⇒ Object
beanstalk url connection
5 6 7 |
# File 'lib/backburner/configuration.rb', line 5 def allq_url @allq_url end |
#default_priority ⇒ Object
default job priority
8 9 10 |
# File 'lib/backburner/configuration.rb', line 8 def default_priority @default_priority end |
#default_queues ⇒ Object
default queues
14 15 16 |
# File 'lib/backburner/configuration.rb', line 14 def default_queues @default_queues end |
#default_worker ⇒ Object
default worker class
16 17 18 |
# File 'lib/backburner/configuration.rb', line 16 def default_worker @default_worker end |
#job_parser_proc ⇒ Object
proc to parse a job body from a string
21 22 23 |
# File 'lib/backburner/configuration.rb', line 21 def job_parser_proc @job_parser_proc end |
#job_serializer_proc ⇒ Object
proc to write the job body to a string
20 21 22 |
# File 'lib/backburner/configuration.rb', line 20 def job_serializer_proc @job_serializer_proc end |
#logger ⇒ Object
logger
15 16 17 |
# File 'lib/backburner/configuration.rb', line 15 def logger @logger end |
#max_job_retries ⇒ Object
max job retries
11 12 13 |
# File 'lib/backburner/configuration.rb', line 11 def max_job_retries @max_job_retries end |
#namespace_separator ⇒ Object
namespace separator
7 8 9 |
# File 'lib/backburner/configuration.rb', line 7 def namespace_separator @namespace_separator end |
#on_error ⇒ Object
error handler
10 11 12 |
# File 'lib/backburner/configuration.rb', line 10 def on_error @on_error end |
#primary_queue ⇒ Object
the general queue
17 18 19 |
# File 'lib/backburner/configuration.rb', line 17 def primary_queue @primary_queue end |
#priority_labels ⇒ Object
priority labels
18 19 20 |
# File 'lib/backburner/configuration.rb', line 18 def priority_labels @priority_labels end |
#reserve_timeout ⇒ Object
duration to wait to reserve on a single server
19 20 21 |
# File 'lib/backburner/configuration.rb', line 19 def reserve_timeout @reserve_timeout end |
#respond_timeout ⇒ Object
default job timeout
9 10 11 |
# File 'lib/backburner/configuration.rb', line 9 def respond_timeout @respond_timeout end |
#retry_delay ⇒ Object
(minimum) retry delay in seconds
12 13 14 |
# File 'lib/backburner/configuration.rb', line 12 def retry_delay @retry_delay end |
#retry_delay_proc ⇒ Object
proc to calculate delay (and allow for back-off)
13 14 15 |
# File 'lib/backburner/configuration.rb', line 13 def retry_delay_proc @retry_delay_proc end |
#tube_namespace ⇒ Object
namespace prefix for every queue
6 7 8 |
# File 'lib/backburner/configuration.rb', line 6 def tube_namespace @tube_namespace end |