Class: RubyReactor::Configuration
- Inherits:
-
Object
- Object
- RubyReactor::Configuration
- Includes:
- Singleton
- Defined in:
- lib/ruby_reactor/configuration.rb
Overview
Configuration class for RubyReactor settings
Instance Attribute Summary collapse
- #async_router ⇒ Object
-
#lock_snooze_base_delay ⇒ Object
Base seconds the Sidekiq worker waits before re-checking a contended lock.
-
#lock_snooze_jitter ⇒ Object
Extra random seconds added to the base delay to avoid thundering herd.
-
#lock_snooze_max_attempts ⇒ Object
How many times a single job can snooze on lock contention before it is marked as failed.
- #logger ⇒ Object
- #sidekiq_queue ⇒ Object
- #sidekiq_retry_count ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#async_router ⇒ Object
41 42 43 |
# File 'lib/ruby_reactor/configuration.rb', line 41 def async_router @async_router ||= RubyReactor::SidekiqAdapter end |
#lock_snooze_base_delay ⇒ Object
Base seconds the Sidekiq worker waits before re-checking a contended lock.
22 23 24 |
# File 'lib/ruby_reactor/configuration.rb', line 22 def lock_snooze_base_delay @lock_snooze_base_delay ||= 5 end |
#lock_snooze_jitter ⇒ Object
Extra random seconds added to the base delay to avoid thundering herd.
27 28 29 |
# File 'lib/ruby_reactor/configuration.rb', line 27 def lock_snooze_jitter @lock_snooze_jitter ||= 5 end |
#lock_snooze_max_attempts ⇒ Object
How many times a single job can snooze on lock contention before it is marked as failed. Set to :infinity to never escalate.
33 34 35 |
# File 'lib/ruby_reactor/configuration.rb', line 33 def lock_snooze_max_attempts @lock_snooze_max_attempts ||= 20 end |
#logger ⇒ Object
37 38 39 |
# File 'lib/ruby_reactor/configuration.rb', line 37 def logger @logger ||= Logger.new($stderr) end |
#sidekiq_queue ⇒ Object
13 14 15 |
# File 'lib/ruby_reactor/configuration.rb', line 13 def sidekiq_queue @sidekiq_queue ||= :default end |
#sidekiq_retry_count ⇒ Object
17 18 19 |
# File 'lib/ruby_reactor/configuration.rb', line 17 def sidekiq_retry_count @sidekiq_retry_count ||= 3 end |
Instance Method Details
#storage ⇒ Object
45 46 47 |
# File 'lib/ruby_reactor/configuration.rb', line 45 def storage @storage ||= RubyReactor::Storage::Configuration.new end |
#storage_adapter ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/ruby_reactor/configuration.rb', line 49 def storage_adapter @storage_adapter ||= case storage.adapter when :redis RubyReactor::Storage::RedisAdapter.new(url: storage.redis_url, **storage.) else raise "Unknown storage adapter: #{storage.adapter}" end end |