Customized sidekiq setup & config - leebalaji1234/bgjob GitHub Wiki
Sidekiq Startup Commands
bundle exec sidekiq
bundle exec sidekiq ... -L log/sidekiq.log
Sidekiq Config with Project
gem 'sidekiq' in Gemfile
touch config/sidekiq.yml
touch tmp/pids/sidekiq.pid
To create sidekiq configuration
sidekiq -C config/sidekiq.yml
Sidekiq configurations in config/sidekiq.yml
:verbose: true
:pidfile: tmp/pids/sidekiq.pid
:concurrency: 25
# :timeout: 30
:queues:
- authentication
- requestreceiver
Limit Sidekiq Threads based on queue
Reference : https://github.com/brainopia/sidekiq-limit_fetch
gem 'sidekiq-limit_fetch'
inside sidekiq.yml:
:limits: queue_name1: 5 queue_name2: 10
or set it dynamically in your code:
Sidekiq::Queue['queue_name1'].limit = 5 Sidekiq::Queue['queue_name2'].limit = 10
Tasks for the queue_name1 will be run by at most 5 workers at the same time
To check how many workers are running a queue use a "#busy" method described below
rails g scaffold AuthenticatesTemp params:text status:integer,limit:1 guid:text
rake db:migrate RAILS_ENV=development
rails g migration AddGuidToRequestReceiverTemps guid:text
If error raise "actioncontroller::unknownformat json" = >
put line on top of controller "respond_to :html, :json"
gem 'responders', '~> 2.0'