Class: Judoscale::Config::JobAdapterConfig
- Inherits:
-
Object
- Object
- Judoscale::Config::JobAdapterConfig
- Defined in:
- lib/judoscale/config.rb
Constant Summary collapse
- UUID_REGEXP =
/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/- DEFAULT_QUEUE_FILTER =
->(queue_name) { !UUID_REGEXP.match?(queue_name) }
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#max_queues ⇒ Object
Returns the value of attribute max_queues.
-
#queue_filter ⇒ Object
Returns the value of attribute queue_filter.
-
#queues ⇒ Object
Returns the value of attribute queues.
-
#track_busy_jobs ⇒ Object
Returns the value of attribute track_busy_jobs.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(identifier, support_busy_jobs: true) ⇒ JobAdapterConfig
constructor
A new instance of JobAdapterConfig.
- #reset ⇒ Object
Constructor Details
#initialize(identifier, support_busy_jobs: true) ⇒ JobAdapterConfig
Returns a new instance of JobAdapterConfig.
26 27 28 29 30 |
# File 'lib/judoscale/config.rb', line 26 def initialize(identifier, support_busy_jobs: true) @identifier = identifier @support_busy_jobs = support_busy_jobs reset end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
23 24 25 |
# File 'lib/judoscale/config.rb', line 23 def enabled @enabled end |
#identifier ⇒ Object
Returns the value of attribute identifier.
23 24 25 |
# File 'lib/judoscale/config.rb', line 23 def identifier @identifier end |
#max_queues ⇒ Object
Returns the value of attribute max_queues.
23 24 25 |
# File 'lib/judoscale/config.rb', line 23 def max_queues @max_queues end |
#queue_filter ⇒ Object
Returns the value of attribute queue_filter.
23 24 25 |
# File 'lib/judoscale/config.rb', line 23 def queue_filter @queue_filter end |
#queues ⇒ Object
Returns the value of attribute queues.
23 24 25 |
# File 'lib/judoscale/config.rb', line 23 def queues @queues end |
#track_busy_jobs ⇒ Object
Returns the value of attribute track_busy_jobs.
24 25 26 |
# File 'lib/judoscale/config.rb', line 24 def track_busy_jobs @track_busy_jobs end |
Instance Method Details
#as_json ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/judoscale/config.rb', line 50 def as_json { identifier => { max_queues: max_queues, queues: queues, queue_filter: queue_filter != DEFAULT_QUEUE_FILTER, track_busy_jobs: track_busy_jobs } } end |
#reset ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/judoscale/config.rb', line 32 def reset @enabled = true @queues = [] @queue_filter = DEFAULT_QUEUE_FILTER # Support for deprecated legacy env var configs. @max_queues = (ENV["JUDOSCALE_MAX_QUEUES"] || ENV["RAILS_AUTOSCALE_MAX_QUEUES"] || 20).to_i self.track_busy_jobs = (ENV["JUDOSCALE_LONG_JOBS"] || ENV["RAILS_AUTOSCALE_LONG_JOBS"]) == "true" end |