Class: Sidekiq::MemoryGuardSettings
- Inherits:
-
Data
- Object
- Data
- Sidekiq::MemoryGuardSettings
- Defined in:
- lib/sidekiq/memory_guard_settings.rb
Overview
Validated immutable configuration for one memory-guard role.
Instance Attribute Summary collapse
-
#grace_time ⇒ Object
readonly
Returns the value of attribute grace_time.
-
#kill_signal ⇒ Object
readonly
Returns the value of attribute kill_signal.
-
#max_rss_mb ⇒ Object
readonly
Returns the value of attribute max_rss_mb.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#shutdown_wait ⇒ Object
readonly
Returns the value of attribute shutdown_wait.
-
#warning_rss_mb ⇒ Object
readonly
Returns the value of attribute warning_rss_mb.
Class Method Summary collapse
Instance Attribute Details
#grace_time ⇒ Object (readonly)
Returns the value of attribute grace_time
5 6 7 |
# File 'lib/sidekiq/memory_guard_settings.rb', line 5 def grace_time @grace_time end |
#kill_signal ⇒ Object (readonly)
Returns the value of attribute kill_signal
5 6 7 |
# File 'lib/sidekiq/memory_guard_settings.rb', line 5 def kill_signal @kill_signal end |
#max_rss_mb ⇒ Object (readonly)
Returns the value of attribute max_rss_mb
5 6 7 |
# File 'lib/sidekiq/memory_guard_settings.rb', line 5 def max_rss_mb @max_rss_mb end |
#role ⇒ Object (readonly)
Returns the value of attribute role
5 6 7 |
# File 'lib/sidekiq/memory_guard_settings.rb', line 5 def role @role end |
#shutdown_wait ⇒ Object (readonly)
Returns the value of attribute shutdown_wait
5 6 7 |
# File 'lib/sidekiq/memory_guard_settings.rb', line 5 def shutdown_wait @shutdown_wait end |
#warning_rss_mb ⇒ Object (readonly)
Returns the value of attribute warning_rss_mb
5 6 7 |
# File 'lib/sidekiq/memory_guard_settings.rb', line 5 def warning_rss_mb @warning_rss_mb end |
Class Method Details
.build(options) ⇒ Sidekiq::MemoryGuardSettings
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sidekiq/memory_guard_settings.rb', line 22 def build() max_rss_mb = Float(.fetch(:max_rss_mb)) settings = new( max_rss_mb:, warning_rss_mb: Float(.fetch(:warning_rss_mb, max_rss_mb)), grace_time: Float(.fetch(:grace_time, 15 * 60)), shutdown_wait: Float(.fetch(:shutdown_wait, 30)), kill_signal: normalize_signal(.fetch(:kill_signal, 'KILL')), role: .fetch(:role, ENV.fetch('SIDEKIQ_ROLE', 'sidekiq')).to_s ) validate!(settings) settings end |