Class: SolidQueue::Configuration
- Inherits:
-
Object
- Object
- SolidQueue::Configuration
- Includes:
- ActiveModel::Model, ActiveModel::Validations::Callbacks
- Defined in:
- lib/solid_queue/configuration.rb
Defined Under Namespace
Classes: Process
Constant Summary collapse
- WORKER_DEFAULTS =
{ queues: "*", threads: 3, processes: 1, polling_interval: 0.1 }
- DISPATCHER_DEFAULTS =
{ batch_size: 500, polling_interval: 1, concurrency_maintenance: true, concurrency_maintenance_interval: 600 }
- SCHEDULER_DEFAULTS =
{ polling_interval: 5, dynamic_tasks_enabled: false }
- DEFAULT_CONFIG_FILE_PATH =
"config/queue.yml"- DEFAULT_RECURRING_SCHEDULE_FILE_PATH =
"config/recurring.yml"- FIBER_QUERY_SCOPED_CONNECTIONS_VERSION =
Gem::Version.new("7.2.0")
Instance Method Summary collapse
- #check ⇒ Object
- #configured_processes ⇒ Object
-
#initialize(**options) ⇒ Configuration
constructor
A new instance of Configuration.
- #mode ⇒ Object
- #standalone? ⇒ Boolean
- #warnings ⇒ Object
Constructor Details
#initialize(**options) ⇒ Configuration
Returns a new instance of Configuration.
44 45 46 |
# File 'lib/solid_queue/configuration.rb', line 44 def initialize(**) @options = .with_defaults() end |
Instance Method Details
#check ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/solid_queue/configuration.rb', line 70 def check if valid? warnings..each { |warning| $stderr.puts warning } $stdout.puts "Solid Queue configuration is valid." true else $stderr.puts "Solid Queue configuration is invalid:" (warnings. + errors.).each do || .each_line { |line| $stderr.puts " #{line.chomp}" } end false end end |
#configured_processes ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/solid_queue/configuration.rb', line 48 def configured_processes if only_work? workers elsif only_recurring? schedulers else dispatchers + workers + schedulers end end |
#mode ⇒ Object
58 59 60 |
# File 'lib/solid_queue/configuration.rb', line 58 def mode [:mode].to_s.inquiry end |
#standalone? ⇒ Boolean
62 63 64 |
# File 'lib/solid_queue/configuration.rb', line 62 def standalone? mode.fork? || [:standalone] end |
#warnings ⇒ Object
66 67 68 |
# File 'lib/solid_queue/configuration.rb', line 66 def warnings @warnings ||= ActiveModel::Errors.new(self) end |