Class: RubyReactor::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/ruby_reactor/configuration.rb

Overview

Configuration class for RubyReactor settings

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#async_routerObject



41
42
43
# File 'lib/ruby_reactor/configuration.rb', line 41

def async_router
  @async_router ||= RubyReactor::SidekiqAdapter
end

#lock_snooze_base_delayObject

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_jitterObject

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_attemptsObject

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

#loggerObject



37
38
39
# File 'lib/ruby_reactor/configuration.rb', line 37

def logger
  @logger ||= Logger.new($stderr)
end

#sidekiq_queueObject



13
14
15
# File 'lib/ruby_reactor/configuration.rb', line 13

def sidekiq_queue
  @sidekiq_queue ||= :default
end

#sidekiq_retry_countObject



17
18
19
# File 'lib/ruby_reactor/configuration.rb', line 17

def sidekiq_retry_count
  @sidekiq_retry_count ||= 3
end

Instance Method Details

#storageObject



45
46
47
# File 'lib/ruby_reactor/configuration.rb', line 45

def storage
  @storage ||= RubyReactor::Storage::Configuration.new
end

#storage_adapterObject



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.redis_options)
                       else
                         raise "Unknown storage adapter: #{storage.adapter}"
                       end
end