Questions tagged [sidekiq]

Sidekiq is a background processing framework for Ruby.

Sidekiq is a multi-threaded background job and message processing gem written by Mike Perham and is available on GitHub.

2372 questions
24
votes
3 answers

Sidekiq - could not obtain a database connection within 5.000 seconds

I get the following warning with Rails 4 and Sidekiq on os x on development 10:13:39 worker.1 | 2014-09-22T07:13:39.857Z 86981 TID-oug0oog10 WARN: could not obtain a database connection within 5.000 seconds (waited 5.002 seconds) 10:13:39 worker.1 |…
Nick Ginanto
  • 31,090
  • 47
  • 134
  • 244
24
votes
2 answers

Can multiple sidekiq instances process the same queue

I'm not familiar with the internals of Sidekiq and am wondering if it's okay to launch several Sidekiq instances with the same configuration (processing the same queues). Is it possible that 2 or more Sidekiq instances will process the same message…
Jacob
  • 1,642
  • 2
  • 15
  • 27
23
votes
3 answers

Sidekiq stop one single, running job

So I need to stop a running Job in Sidekiq (3.1.2) programmatically, not a scheduled one. I did read the API documentation but didn't really find anything about cancelling running jobs. Is this possible with sidekiq? When this is not directly…
Figedi
  • 383
  • 1
  • 2
  • 11
23
votes
2 answers

Writing tests for a sidekiq worker

I am using the rspec-sidekiq gem (https://github.com/philostler/rspec-sidekiq) to help test a worker I am writing, but for some reason my test keeps failing. Here is my Test: require 'spec_helper' describe CommunicationWorker do it { should…
dennismonsewicz
  • 25,132
  • 33
  • 116
  • 189
22
votes
6 answers

How to set retry count for Sidekiq with ActiveJob?

From the Rails API, I found ActiveJob can retry_job interval: my_job_instance.enqueue my_job_instance.enqueue wait: 5.minutes my_job_instance.enqueue queue: :important my_job_instance.enqueue wait_until:…
scho
  • 3,275
  • 6
  • 19
  • 30
22
votes
3 answers

Sidekiq configuration for multiple environments

I have looked at multiple sources and tried various scenarios but couldn't resolve this hence the issue. Please point me in the right direction. Like everybody I have 3 env (development, staging and production). I have the following in my…
user1687078
  • 1,353
  • 3
  • 10
  • 10
21
votes
2 answers

Sidekiq - view completed jobs

Is it possible to somehow view sidekiq completed job list - for example, find all PurchaseWorkers with params (1)? Yesterday in my app delayed method that was supposed to run didn't and associated entity (lets say 'purchase') got stuck in limbo with…
user124
  • 1,632
  • 1
  • 11
  • 11
21
votes
3 answers

Why does Sidekiq not close old connections?

My Rails 4.1 application uses Sidekiq to run measurements in Celluloid actors. It continously runs out of database connections. It appears that Sidekiq opens 2 connections per job, and old connections never get closed properly. What the system…
slhck
  • 36,575
  • 28
  • 148
  • 201
21
votes
5 answers

Sidekiq retry count in job

Is there a way to get the retry count for the current job? I want the job to stop, not crash, after x retries. I would like to ask the retry count in the perform method so I could simply return if the retry count equals x. def perform(args) return…
Cimm
  • 4,653
  • 8
  • 40
  • 66
21
votes
3 answers

Sidekiq: change rate of retry for failed job?

I have jobs of a particular type that I'd like to have retry more frequently than set by the default Sidekiq interval. Is this currently possible? Ideally the job would retry every 5 seconds for up to a minute. Not entirely sure this is currently…
randombits
  • 47,058
  • 76
  • 251
  • 433
21
votes
5 answers

How to tell if sidekiq is connected to redis server?

Using the console, how can I tell if sidekiq is connected to a redis server? I want to be able to do something like this: if (sidekiq is connected to redis) # psuedo code MrWorker.perform_async('do_work', user.id) else …
keruilin
  • 16,782
  • 34
  • 108
  • 175
21
votes
4 answers

Run Sidekiq as daemon on Ubuntu

How can I run sidekiq as daemon on Ubuntu? If I run bundle exec sidekiq -D I get invalid option: -D, is there any way to run it without some other controller, like god, upstart...?
Philip
  • 6,827
  • 13
  • 75
  • 104
21
votes
9 answers

Sidekiq worker not getting triggered

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 …
AnkitG
  • 6,438
  • 7
  • 44
  • 72
19
votes
1 answer

Sidekiq concurrency and database connections pool

Here is my problem: Each night, I have to process around 50k Background Jobs, each taking an average of 60s. Those jobs are basically calling the Facebook, Instagram and Twitter APIs to collect users' posts and save them in my DB. The jobs are…
Heimezi
  • 191
  • 1
  • 3
19
votes
3 answers

How set timeout for jobs in sidekiq

I encountered an issue with sidekiq: I want to set timeout for jobs, meaning when a job has process time greater than timeout then that job will stop. I have searched how to set global timeout config in file sidekiq.yml. But I want to set separate…
huyhoang-vn
  • 335
  • 1
  • 3
  • 13