0

Context: First time usage of ActiveJob via Sidekiq and Redis.

Situation: Sidekiq and redis are installed and running (route /sidekiq does generate the control panel) and is polling.

Issue(s?): Installation on remote server and enabling rather opaque... which may explain whay a default defined job is not executing although the server is inactive.

Maybe the sequence of going through Rails, then Sidekiq, then redis documentation was mistaken.

Uncertainty #1: However, I finally picked up that redis-server has to be launched. But what is not clear is how this can be part of the deployment process and a server start-up process to ensure this is running without manual input?

Uncertainty #2: Documentation indicates that sidekiq should be started via

bundle exec sidekiq -q critical -q high -q default -q low

again, what is not clear is how this can be part of the deployment process and a server start-up process to ensure this is running without manual input?

Uncertainty #3: if one of the above two is done improperly it may explain the following behaviour.

After starting sidekiq with the above command (this is assuming 4 levels of priority are needed. In the present context they are not; but I wanted to test and observe behaviour) and through an action activating a job

GenerateCodeJob.perform_later(item, shop)

=> it is found in Sidekiq's queues, under the Queue default and sits there for yonks.

My understanding is that jobs are performed based on server resource availability. But that is clearly not the case.

So what are the priorities and what type of timings are involved? Or could the set-up be mistaken?

Jerome
  • 5,583
  • 3
  • 33
  • 76
  • If the job can be seen under default queue, it should be run provided sidekiq and redis are running. Is there some issue with the job itself running for long time (waiting for some data, long/infinite loop, etc)? Are you able to run the job from console? `GenerateCodeJob.new.perform(item, shop)` - use the exact same item and shop records. – tejasbubane Dec 08 '22 at 23:28
  • No, the job is not that long running and it is the only one in the queue. It simply does not fire **unless** quitting sidekiq (so it then completes jobs in queue!). Thus I may be thrown off by the notion of workers & how they are set - have not found proper documentation about that. – Jerome Dec 09 '22 at 08:29
  • Assuming you are using activejob make sure you've set the adapter to :sidekiq and try to explicitly specify default queue. ref: https://github.com/mperham/sidekiq/wiki/Active-Job#active-job-setup – tejasbubane Dec 12 '22 at 16:21

0 Answers0