Class: HealthMonitor::Providers::Sidekiq::Configuration
- Inherits:
-
Object
- Object
- HealthMonitor::Providers::Sidekiq::Configuration
- Defined in:
- lib/health_monitor/providers/sidekiq.rb
Constant Summary collapse
- DEFAULT_QUEUE_NAME =
'default'
- DEFAULT_LATENCY_TIMEOUT =
30
- DEFAULT_QUEUES_SIZE =
100
Instance Attribute Summary collapse
-
#queues ⇒ Object
readonly
Returns the value of attribute queues.
Instance Method Summary collapse
- #add_queue_configuration(queue_name, latency: DEFAULT_LATENCY_TIMEOUT, queue_size: DEFAULT_QUEUES_SIZE) ⇒ Object
- #default_queue ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #latency ⇒ Object
- #latency=(value) ⇒ Object
- #queue_size ⇒ Object
- #queue_size=(value) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 21 |
# File 'lib/health_monitor/providers/sidekiq.rb', line 18 def initialize @queues = {} @queues[DEFAULT_QUEUE_NAME] = { latency: DEFAULT_LATENCY_TIMEOUT, queue_size: DEFAULT_QUEUES_SIZE } end |
Instance Attribute Details
#queues ⇒ Object (readonly)
Returns the value of attribute queues.
16 17 18 |
# File 'lib/health_monitor/providers/sidekiq.rb', line 16 def queues @queues end |
Instance Method Details
#add_queue_configuration(queue_name, latency: DEFAULT_LATENCY_TIMEOUT, queue_size: DEFAULT_QUEUES_SIZE) ⇒ Object
43 44 45 46 47 |
# File 'lib/health_monitor/providers/sidekiq.rb', line 43 def add_queue_configuration(queue_name, latency: DEFAULT_LATENCY_TIMEOUT, queue_size: DEFAULT_QUEUES_SIZE) raise SidekiqException.new('Queue name is mandatory') if queue_name.blank? queues[queue_name] = { latency: latency, queue_size: queue_size } end |
#default_queue ⇒ Object
39 40 41 |
# File 'lib/health_monitor/providers/sidekiq.rb', line 39 def default_queue queues[DEFAULT_QUEUE_NAME] end |
#latency ⇒ Object
27 28 29 |
# File 'lib/health_monitor/providers/sidekiq.rb', line 27 def latency default_queue[:latency] end |
#latency=(value) ⇒ Object
23 24 25 |
# File 'lib/health_monitor/providers/sidekiq.rb', line 23 def latency=(value) default_queue[:latency] = value end |
#queue_size ⇒ Object
35 36 37 |
# File 'lib/health_monitor/providers/sidekiq.rb', line 35 def queue_size default_queue[:queue_size] end |
#queue_size=(value) ⇒ Object
31 32 33 |
# File 'lib/health_monitor/providers/sidekiq.rb', line 31 def queue_size=(value) default_queue[:queue_size] = value end |