Class: SidekiqAlive::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/sidekiq_alive/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



22
23
24
# File 'lib/sidekiq_alive/config.rb', line 22

def initialize
  set_defaults
end

Instance Attribute Details

#callbackObject

Returns the value of attribute callback.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def callback
  @callback
end

#concurrencyObject

Returns the value of attribute concurrency.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def concurrency
  @concurrency
end

#custom_liveness_probeObject

Returns the value of attribute custom_liveness_probe.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def custom_liveness_probe
  @custom_liveness_probe
end

#hostObject

Returns the value of attribute host.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def host
  @host
end

#liveness_keyObject

Returns the value of attribute liveness_key.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def liveness_key
  @liveness_key
end

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def logger
  @logger
end

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def path
  @path
end

#portObject

Returns the value of attribute port.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def port
  @port
end

#queue_prefixObject

Returns the value of attribute queue_prefix.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def queue_prefix
  @queue_prefix
end

#quiet_timeoutObject

Returns the value of attribute quiet_timeout.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def quiet_timeout
  @quiet_timeout
end

#registered_instance_keyObject

Returns the value of attribute registered_instance_key.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def registered_instance_key
  @registered_instance_key
end

#serverObject

Returns the value of attribute server.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def server
  @server
end

#shutdown_callbackObject

Returns the value of attribute shutdown_callback.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def shutdown_callback
  @shutdown_callback
end

#time_to_liveObject

Returns the value of attribute time_to_live.



7
8
9
# File 'lib/sidekiq_alive/config.rb', line 7

def time_to_live
  @time_to_live
end

Instance Method Details

#registration_ttlObject



42
43
44
# File 'lib/sidekiq_alive/config.rb', line 42

def registration_ttl
  @registration_ttl || time_to_live * 3
end

#set_defaultsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/sidekiq_alive/config.rb', line 26

def set_defaults
  @host = ENV.fetch("SIDEKIQ_ALIVE_HOST", "0.0.0.0")
  @port = ENV.fetch("SIDEKIQ_ALIVE_PORT", 7433)
  @path = ENV.fetch("SIDEKIQ_ALIVE_PATH", "/")
  @liveness_key = "SIDEKIQ::LIVENESS_PROBE_TIMESTAMP"
  @time_to_live = 10 * 60
  @callback = proc {}
  @registered_instance_key = "SIDEKIQ_REGISTERED_INSTANCE"
  @queue_prefix = :"sidekiq-alive"
  @custom_liveness_probe = proc { true }
  @shutdown_callback = proc {}
  @concurrency = Integer(ENV.fetch("SIDEKIQ_ALIVE_CONCURRENCY", 2), exception: false) || 2
  @server = ENV.fetch("SIDEKIQ_ALIVE_SERVER", nil)
  @quiet_timeout = Integer(ENV.fetch("SIDEKIQ_ALIVE_QUIET_TIMEOUT", 180), exception: false) || 180
end