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



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

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

#lock_snooze_base_delayObject

Base seconds the Sidekiq worker waits before re-checking a contended lock.



23
24
25
# File 'lib/ruby_reactor/configuration.rb', line 23

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.



28
29
30
# File 'lib/ruby_reactor/configuration.rb', line 28

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.



34
35
36
# File 'lib/ruby_reactor/configuration.rb', line 34

def lock_snooze_max_attempts
  @lock_snooze_max_attempts ||= 20
end

#loggerObject



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

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

#middlewaresObject



59
60
61
# File 'lib/ruby_reactor/configuration.rb', line 59

def middlewares
  @middlewares ||= []
end

#sidekiq_queueObject



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

def sidekiq_queue
  @sidekiq_queue ||= :default
end

#sidekiq_retry_countObject



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

def sidekiq_retry_count
  @sidekiq_retry_count ||= 3
end

Instance Method Details

#storageObject



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

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

#storage_adapterObject



50
51
52
53
54
55
56
57
# File 'lib/ruby_reactor/configuration.rb', line 50

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