Sidekiq Worker Not Getting Triggered

Sidekiq worker not getting triggered

I had a similar problem where Sidekiq was running but when I called perform_async it didn't do anything except return true.

The problem was rspec-sidekiq was added to my ":development, :test" group. I fixed the problem by moving rspec-sidekiq to the ":test" group only.

Sidekiq worker not getting queued in testing

This issue was fixed by installing the test_after_commit gem.

Apparently after_commit's don't fire in tests unless you either use that gem or specify the necessary changes in a test_helper. I opted for the gem option just to keep things a little easier.

Sidekiq not processing queue

The reason was in our case: Sidekiq may look for the wrong queue. By default Sidekiq uses a queue named "default". We used two different queue names, and defined them in config/sidekiq.yml

# configuration file for Sidekiq
:queues:
- queue_name_1
- queue_name_2

The problem is that this config file is not automatically loaded by default in your development environment (unlike database.yml or thinking_sphinx.yml for instance) by a simple bundle exec sidekiq command. Thus we wrote our jobs in two certain queues, and Sidekiq was waiting for jobs in a third queue (the default one). You have to pass the path to the config file as a parameter through the -Cor --config option:

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

or you can pass the queue names directly (no spaces allowed here after the comma):

bundle exec sidekiq -q queue_name_1,queue_name_2

To find the problem out it is helpful to pass the option -v or --verbose at the command line, too, or to use :verbose: true in the sidekiq.yml file. Everything which is defined in a config file is of course useless if the config file is not loaded.. Therefore make sure you are using the right config file first.

What happends when a perform_async is called but sidekiq is not running?

Simple answer: it is not done. It will be done later

As the name it self is saying it puts it in a que. When you turn on sidekiq it will read all data from que and execute all tasks.

But for this to work you need to have Redis working. Redis is responsible for saving data in a que, it is a kind of memory. Without Redis you would get an error.

Rails test triggers Sidekiq warning

Note the part about Symbols.

https://github.com/mperham/sidekiq/wiki/Best-Practices#1-make-your-job-parameters-small-and-simple

The arguments you pass to perform_async must be composed of simple JSON datatypes: string, integer, float, boolean, null(nil), array and hash. This means you must not use ruby symbols as arguments.



Related Topics



Leave a reply



Submit