Class: Q::Methods::Sidekiq::QueueTask

Inherits:
Object
  • Object
show all
Defined in:
lib/q/methods/sidekiq.rb

Class Method Summary collapse

Class Method Details

.call(*args) ⇒ Object

-c, --concurrency INT processor threads to use -d, --daemon Daemonize process -e, --environment ENV Application environment -g, --tag TAG Process tag for procline -i, --index INT unique process index on this machine -p, --profile Profile all code run by Sidekiq -q, --queue QUEUE... Queues to process with optional weights -r, --require [PATH|DIR] Location of Rails application with workers or file to require -t, --timeout NUM Shutdown timeout -v, --verbose Print more verbose output -C, --config PATH path to YAML config file -L, --logfile PATH path to writable logfile -P, --pidfile PATH path to pidfile -V, --version Print version and exit -h, --help Show help



49
50
51
52
53
54
55
56
# File 'lib/q/methods/sidekiq.rb', line 49

def self.call(*args)
  setup!
  cmd = "bundle exec sidekiq "
  cmd << ENV["QUEUE"]   if ENV["QUEUE"]
  cmd << args.join(" ") if args.any?
  puts cmd.inspect
  exec cmd
end

.setup!Object



58
59
60
61
62
63
64
# File 'lib/q/methods/sidekiq.rb', line 58

def self.setup!
  return unless database_url = ENV['DATABASE_URL']
  Sidekiq.configure_server do |config|
    ENV['DATABASE_URL'] = "#{database_url}?pool=25"
    ActiveRecord::Base.establish_connection
  end
end