Don't trust what you see in the Rails console. (because Rails isn't going to read config/sidekiq.yml
, it doesn't need to know about those settings)
Trust what you see in the Sidekiq console. (because when sidekiq starts it reads config/sidekiq.yml
to apply its settings)
Given an example worker:
class ExampleWorker
include Sidekiq::Worker
def perform
puts Sidekiq.options[:concurrency]
end
end
Open a Rails console and run the job synchronously:
ExampleWorker.new.perform
10
This is the default.
Now run it asynchronously:
ExampleWorker.perform_async
=> "628773ecad22c4b19e4d08a4"
Open Sidekiq and wait for the job to run:
2019-11-03T22:59:13.786Z pid=2663 tid=ovyfd5os3 INFO: Running in ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin19]
2019-11-03T22:59:13.786Z pid=2663 tid=ovyfd5os3 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2019-11-03T22:59:13.786Z pid=2663 tid=ovyfd5os3 INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
2019-11-03T22:59:13.786Z pid=2663 tid=ovyfd5os3 INFO: Booting Sidekiq 6.0.3 with redis options {:id=>"Sidekiq-server-PID-2663", :url=>nil}
2019-11-03T22:59:13.803Z pid=2663 tid=ovyfd5os3 INFO: Starting processing, hit Ctrl-C to stop
2019-11-03T22:59:18.176Z pid=2663 tid=ovyfdnd37 class=ExampleWorker jid=628773ecad22c4b19e4d08a4 INFO: start
3
2019-11-03T22:59:18.279Z pid=2663 tid=ovyfdnd37 class=ExampleWorker jid=628773ecad22c4b19e4d08a4 elapsed=0.104 INFO: done
Sidekiq is applying the setting properly.