class Shinq::Configuration

@!attribute abort_on_error

@return [Boolean] Whether do +queue_abort()+ on performing failure.
@see Shinq::Launcher#run

Defaults to +true+, which means that worker do +queue_end()+ AFTER it proceeds a job.
If it is +false+, worker do +queue_end()+ BEFORE it proceeds a job.
You may need to set it +false+ for jobs which take very long time to proceed.
You may also need to handle performing error manually then.

Constants

DEFAULT

Attributes

abort_on_error[RW]
daemonize[RW]
db_config[RW]
default_db[RW]
graceful_kill_timeout[RW]
lifecycle[RW]
process[RW]
queue_db[RW]
queue_timeout[RW]
require[RW]
sleep_sec_on_error[RW]
statistics[RW]
worker_name[RW]

Public Class Methods

new(opts) click to toggle source
# File lib/shinq/configuration.rb, line 25
def initialize(opts)
  %i(require worker_name db_config queue_db default_db process queue_timeout daemonize statistics lifecycle abort_on_error sleep_sec_on_error).each do |k|
    value = opts.key?(k) ? opts[k] : DEFAULT[k]
    send(:"#{k}=", value)
  end
end

Public Instance Methods

db_defined?(db_name) click to toggle source
# File lib/shinq/configuration.rb, line 45
def db_defined?(db_name)
  !!(db_config && db_config[db_name])
end
default_db_config() click to toggle source
# File lib/shinq/configuration.rb, line 40
def default_db_config
  raise ConfigurationError if !(default_db && db_defined?(default_db))
  db_config[default_db]
end
worker_class() click to toggle source
# File lib/shinq/configuration.rb, line 32
def worker_class
  worker_class = worker_name.camelize.safe_constantize
  unless worker_class
    raise ConfigurationError, "worker class #{worker_name.camelize} corresponding to #{worker_name} does not exist"
  end
  worker_class
end