This will run the loans queue with the weight of 5
bundle exec sidekiq -q loans,5
SO: How to run Sidekiq in production
ps -ef | grep sidekiq | grep -v grep | awk '{print $2}' | xargs kill -9
See the pid:
(add_sidekiq_134)$ ps -ef | grep sidekiq
501 89943 4082 0 5:10PM ttys002 0:03.19 sidekiq 4.2.2 common_crawl_extractor [3 of 25 busy]
501 89957 89943 0 5:10PM ttys002 0:00.01 /Users/wkotzan/.rvm/gems/ruby-2.3.1/gems/rb-fsevent-0.9.7/bin/fsevent_watch --latency 0.1 /Users/wkotzan/.rvm/gems/ruby-2.3.1/gems/sidekiq-4.2.2
501 89979 71666 0 5:10PM ttys011 0:00.00 grep sidekiq
Shut down pid (stop Sidekiq from picking up new workers):
kill -USR1 89943
Shut down pid (force shutdown of running workers and push them back into the queue):
kill -TERM 89943
[2] pry(main)> q = Sidekiq::Queue.all
=> [#<Sidekiq::Queue:0x007ff683761ef8 @name="default", @rname="queue:default">]
[3] pry(main)> q.first.size
=> 4
[4] pry(main)> q.first.clear
=> [1, true]
[5] pry(main)> q.first.size
=> 0
Sidekiq::Queue.all.each { |q| puts "#{q.name}: #{Sidekiq::Queue.new(q.name).size}" }
Sidekiq::Queue.new(<queue_name>).each { |job| puts "#{job.class}: #{job.args}" }
> Sidekiq.options
=> {:queues=>[],
:labels=>[],
:concurrency=>25,
:require=>".",
:environment=>nil,
:timeout=>8,
:poll_interval_average=>nil,
:average_scheduled_poll_interval=>15,
:error_handlers=>[#<Sidekiq::ExceptionHandler::Logger:0x007f844aa7bae0>],
:lifecycle_events=>{:startup=>[], :quiet=>[], :shutdown=>[], :heartbeat=>[]},
:dead_max_jobs=>10000,
:dead_timeout_in_seconds=>15552000,
:reloader=>#<Proc:0x007f8449a8d480@/Users/wkotzan/.rvm/gems/ruby-2.3.1@banks/gems/sidekiq-4.2.7/lib/sidekiq.rb:35>,
:executor=>#<Proc:0x007f8449a8d458@/Users/wkotzan/.rvm/gems/ruby-2.3.1@banks/gems/sidekiq-4.2.7/lib/sidekiq.rb:36>}
> Sidekiq.redis { |c| puts c.client.location }
localhost:6379