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
19
votes
3 answers

sidekiq does not generate sidekiq.pid file on heroku, using with Redistogo

I've been struggling for two days with getting sidekiq work on heroku production environment. I've read all the available documentation about similar issues, and still haven't been able to produce a working solution, I'd really like some help! After…
Stephens
  • 537
  • 5
  • 13
19
votes
1 answer

Is my understanding of Unicorn, Sidekiq and DB Pool size correct?

I have Unicorn, Sidekiq and Postgres setup. I am trying to understand the right configuration to set up so that I don't hit the maximum db connection limit. In Opsworks, the m1.small Postgres RDS instance can have a max of 121 connections. I have a…
Christian Fazzini
  • 19,613
  • 21
  • 110
  • 215
19
votes
4 answers

Log inside Sidekiq worker

I'm trying to log the progress of my sideqik worker using tail -f log/development.log in development and heroku logs in production. However, everything inside the worker and everything called by the worker does not get logged. In the code below,…
migu
  • 4,236
  • 5
  • 39
  • 60
18
votes
2 answers

How can I detect whether my code is running "inside" Sidekiq server or Puma?

I'm using Puma as a web server, and Sidekiq as my queue runner. For multiple things (Database connections, Redis connections, other external services) I'm using the ConnectionPool gem to manage safe access to connections. Now, depending on whether…
Daniel Magliola
  • 30,898
  • 61
  • 164
  • 243
18
votes
2 answers

Best way to monitor for completion of a Sidekiq job?

I'm using a Sidekiq worker to complete some requests to Facebook after a user signs-in for the first time. Typically the task takes around 20 seconds or so. I'd like to load some information on to the page using an ajax request as soon as the sync…
Paul
  • 2,021
  • 5
  • 22
  • 33
18
votes
3 answers

How does Sidekiq passes arguments to the perform method?

I have this Sidekiq worker: class DealNoteWorker include Sidekiq::Worker sidekiq_options queue: :email def perform(options = {}) if options[:type] == "deal_watch_mailer" deal_watchers = DealWatcher.where("deal_id = ?",…
Peter Butterworth
  • 181
  • 1
  • 1
  • 3
17
votes
1 answer

What is the difference between perform_later and perform_async?

According to ActiveJob docs to enqueue a job I should use perform_later. Sidekiq docs implement perform_async, but the ActiveJob part of the docs suggests using perform_later. I've used perform_async previously in Rails, so do these differ in any…
sloneorzeszki
  • 1,274
  • 3
  • 12
  • 22
17
votes
3 answers

Getting Action Cable to broadcast in Sidekiq Job

I'm using Rails 5 in a docker environment and I can get Action Cable to broadcast on a Sidekiq worker perfectly fine, using worker.new.perform. But for the life of me, I cannot get it to broadcast while using worker.perform_async. Here is my…
ChrisPalmer
  • 285
  • 4
  • 15
17
votes
2 answers

Passing an options hash to a sidekiq worker

I remember when I tried passing a params (JSON) option to a sidekiq worker method and it didn't work out well because I was referencing the option like: options[:email_address] But I think it would have worked if I did: options["email_address"] So…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
17
votes
4 answers

How can I run an ActiveJob in Rails console for debugging?

I currently have an ActiveJob that I've created and use Sidekiq to queue it. I'm wanting to debug the job, but for me to see any messages I program into it I have to check my log files. I feel like it would be more convenient to be able to see my…
daveomcd
  • 6,367
  • 14
  • 83
  • 137
17
votes
2 answers

Colon in the front: YAML syntax

I'm currently using Sidekiq in a project and I have the following YAML config file: :concurrency: 5 :pidfile: /tmp/pids/sidekiq.pid :logfile: log/sidekiq.log staging: :concurrency: 10 production: :concurrency: 20 queues: - default I haven't…
Maikon
  • 1,382
  • 16
  • 16
17
votes
2 answers

Rails 4.2 - Sidekiq not sending emails in development

I have a rails app in which I have a method where I send a lot of emails. I would like to perform this action asynchronously. To do it I've tried to use Sidekiq, but I can't get it to work properly - it doesn't send any emails. Sending email worked…
Anders
  • 2,903
  • 7
  • 58
  • 114
17
votes
1 answer

Is it possible to run sidekiq on a separate host from the rails host?

I'd like to setup sidekiq so that it runs on a separate host from my rails app, to avoid weighing down the web server when running memory-intensive background tasks. What are the configuration details I need to look at? Are there known best…
Ovesh
  • 5,209
  • 11
  • 53
  • 73
17
votes
3 answers

How to test background jobs (Sidekiq) with Rspec?

A large part of my application relies on background jobs to process user's websites, so I need to write some tests to cover these. First question is how to test code that's in a Sidekiq worker class, for example app/workers/some_worker.rb class…
mind.blank
  • 4,820
  • 3
  • 22
  • 49
17
votes
1 answer

Restarting Sidekiq

What is the correct way to restart sidekiq. It seems to cache my workers' code when I start it, so every time I make a change to my workers I need to restart it. I'm doing this with Ctrl/C, but the process takes a long time to wind down and return…
Undistraction
  • 42,754
  • 56
  • 195
  • 331