Sidekiq worker not getting triggered

2019-02-12 01:08发布

I am using Sidekiq for my background jobs:

I have a worker app/workers/data_import_worker.rb

class DataImportWorker
 include Sidekiq::Worker
 sidekiq_options retry: false

  def perform(job_id,file_name)
    begin
    #Some logic in it .....
  end
 end

Called from a file lib/parse_excel.rb

  def parse_raw_data
      #job_id and #filename are defined bfr
      DataImportWorker.perform_async(job_id,filename)   
  end

As soon as i trigger it from my action the worker is not getting called.. Redis is running on localhost:6379

Any idea why this must be happening. The Environment is Linux.

9条回答
Rolldiameter
2楼-- · 2019-02-12 01:32

You need to specify the name of the queue that worker is for.

Example: sidekiq_options retry: false, :queue => data_import_worker

data_import_worker can be any name you want to give it.

Then when you go to the web interface: yoursite.com/sidekiq, you'll be able to see the current workers for the queue "data_import_worker"

查看更多
smile是对你的礼貌
3楼-- · 2019-02-12 01:34

is it realy run multiple workers on standalone sidekiq? for example I have 2 workers: ProccessWorker CallbackWorker

when I am runnigs sidekiq: bundle exec sidekiq -r ./workers/proccess_worker.rb -C ./config/sidekiq.yml

only one worker in same time.

查看更多
Viruses.
4楼-- · 2019-02-12 01:43

Start sidekiq from the root directory of your Rails app. For example,

bundle exec sidekiq -e staging -C config/sidekiq.yml

查看更多
登录 后发表回答