Class: QPush::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/qpush/config.rb

Constant Summary collapse

DEFAULTS =
{
  redis_url: ENV['REDIS_URL'],
  database_url: ENV['DATABASE_URL'],
  redis_pool: 10,
  database_pool: 10,
  workers: 2,
  namespace: 'default',
  queue_threads: 2,
  perform_threads: 2,
  delay_threads: 1,
  priorities: 5,
  jobs_path: '/jobs'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



37
38
39
# File 'lib/qpush/config.rb', line 37

def initialize
  DEFAULTS.each { |key, value| send("#{key}=", value) }
end

Instance Attribute Details

#database_poolObject

Returns the value of attribute database_pool.



33
34
35
# File 'lib/qpush/config.rb', line 33

def database_pool
  @database_pool
end

#database_urlObject

Returns the value of attribute database_url.



33
34
35
# File 'lib/qpush/config.rb', line 33

def database_url
  @database_url
end

#delay_threadsObject

Returns the value of attribute delay_threads.



33
34
35
# File 'lib/qpush/config.rb', line 33

def delay_threads
  @delay_threads
end

#jobs_pathObject

Returns the value of attribute jobs_path.



33
34
35
# File 'lib/qpush/config.rb', line 33

def jobs_path
  @jobs_path
end

#namespaceObject

Returns the value of attribute namespace.



33
34
35
# File 'lib/qpush/config.rb', line 33

def namespace
  @namespace
end

#perform_threadsObject

Returns the value of attribute perform_threads.



33
34
35
# File 'lib/qpush/config.rb', line 33

def perform_threads
  @perform_threads
end

#prioritiesObject

Returns the value of attribute priorities.



33
34
35
# File 'lib/qpush/config.rb', line 33

def priorities
  @priorities
end

#queue_threadsObject

Returns the value of attribute queue_threads.



33
34
35
# File 'lib/qpush/config.rb', line 33

def queue_threads
  @queue_threads
end

#redis_poolObject

Returns the value of attribute redis_pool.



33
34
35
# File 'lib/qpush/config.rb', line 33

def redis_pool
  @redis_pool
end

#redis_urlObject

Returns the value of attribute redis_url.



33
34
35
# File 'lib/qpush/config.rb', line 33

def redis_url
  @redis_url
end

#workersObject

Returns the value of attribute workers.



33
34
35
# File 'lib/qpush/config.rb', line 33

def workers
  @workers
end

Instance Method Details

#manager_optionsObject



49
50
51
52
53
54
# File 'lib/qpush/config.rb', line 49

def manager_options
  {
    workers: workers,
    options: worker_options
  }
end

#redisObject



56
57
58
59
60
61
# File 'lib/qpush/config.rb', line 56

def redis
  {
    size: redis_pool,
    url: redis_url
  }
end

#worker_optionsObject



41
42
43
44
45
46
47
# File 'lib/qpush/config.rb', line 41

def worker_options
  {
    perform_threads: perform_threads,
    queue_threads: queue_threads,
    delay_threads: delay_threads
  }
end