Class: SolidQueue::Configuration

Inherits:
Object
  • Object
show all
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
}
DEFAULT_CONFIG_FILE_PATH =
"config/queue.yml"
DEFAULT_RECURRING_SCHEDULE_FILE_PATH =
"config/recurring.yml"

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Configuration

Returns a new instance of Configuration.



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

def initialize(**options)
  @options = options.with_defaults(default_options)
end

Instance Method Details

#configured_processesObject



32
33
34
35
36
37
# File 'lib/solid_queue/configuration.rb', line 32

def configured_processes
  if only_work? then workers
  else
    dispatchers + workers + schedulers
  end
end

#max_number_of_threadsObject



39
40
41
42
# File 'lib/solid_queue/configuration.rb', line 39

def max_number_of_threads
  # At most "threads" in each worker + 1 thread for the worker + 1 thread for the heartbeat task
  workers_options.map { |options| options[:threads] }.max + 2
end