Get a primary key error in Rails using Sidekiq and Sidekiq-Cron

I have a Rails project that uses Sidekiq for worker tasks, and Sidekiq-Cron to handle scheduling. I am running into a problem, though. I built a controller (below) that handled all of my API querying, validation of data, and then inserting data into

Sidekiq pro web UI must be READONLY for specific users

Is it possible to prevent sidekiq deletion and creation of jobs/queue for specific users? We are using sidekiq with ruby on rails.While I am not sure how to do this within the gem, you should be able to create a fork of the gem and add checks in the

Sidekiq application rails use high memory

I have a Rails 4 app deployed on Digital Ocean using Ubuntu 14.04.5 LTS. The app seems to run fine but the system runs at 95% memory all the time. I even upgraded the droplet to double the RAM and it's still at 95%. Here is my top output: top - 11:03

Require a template file in the worker sidekiq

I have a model file 'abc.rb' inside model directory. class Abc class << self //codes end end There are certain methods in the abc.rb file that I want to call to in my workers/bulk_uploader.rb file. I got an error while calling it like Abc.some_metho

Rails: management of several sidekiqs without upstart script

Once upon a time, I had one app - Cashyy. It used sidekiq. I deployed it and used this upstart script to manage sidekiq (start/restart). I decide to deploy another app to the same server. The app (let's call it Giimee) also uses sidekiq. And here is

Sidekiq: Find the last job

I have two Sidekiq jobs. The first loads a feed of articles in JSON and splits it into multiple jobs. It also creates a log and stores a start_time. class LoadFeed include Sidekiq::Worker def perform url log = Log.create! start_time: Time.now, url: u

sidekiq rails can not find the created record

I am using sidekiq to run some job after creating a record. when the job tries to find the record with the created ID, there are random cases where it raises a RecordNotFound. how can this be possible? class Person def self.test_create p = Person.cre

Why does not Sidekiq close the 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 does E

How can I prevent database connections from expiring in Rails?

I have a Rails system in which every half hour, the following is done: There are 15 clients somewhere else on the network The server creates a record called Measurement for each of these clients The measurement records are configured, and then they a

How are you rescheduling a job in Sidekiq?

I have implemented scheduled notifications using Sidekiq. I want to also add an ability of rescheduling jobs that haven't been run yet. I do see a reschedule method in the sidekiq api code https://github.com/mperham/sidekiq/blob/061068c551bd96eb6aa79

heroku rails application download mobile browser file timeout

I've experienced an odd behavior in my heroku rails app that I've been fighting for two days and still cannot grasp that the problem is. I have a heroku rails app, with a feature that allows user to upload photos. The photo upload feature works fine

Context of execution of Sidekiq works

I want to perform some tasks in background but with something like "run as". In other words, like a task was launched by the user from the context of his session. Something like def perform env['warden'].set_user(@task_owner_user) MyService::cur

sidekiq - Uninitialized constant RegistrationsWorker

I use Sidekiq and this below is my code: authentications_controller.rb: def auth_provider auth, user .... .... Facebook.loop_import fb_user, 'POST', user end Facebook.rb: def self.loop_import(fb_user, type, user) fb_user.posts({:locale => user.langua

Rails: How to restart sidekiq?

I am using sidekiq gem to run API calls in background. I ran sidekiq in Daemon process like: bundle exec sidekiq -d Now I made some changes in my method, so I want to restart sidekiq. I tried to kill the sidekiq by using the below command: kill -9 pr

Sidekiq logging redis queries

I am trying to debug sidekiq at low level. In order to do this I want all queries to be logged. Redis client logger can be enabled with: redis.client.logger = Logger.new(STDOUT) redis.set('a', 'b') Results in: D, [2014-05-13T11:35:34.787624 #46689] D

How to run sidekiq in the production server?

I have a server with apache + passenger. How will I run sidekiq in production? Any configuration needed to run the bundle exec sidekiq Thanksbundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml -e production -d, Daemonize process -L, path

Why is my PostgreSQL server forced?

My database is very cpu constrained, and I can't find the root cause of the issue. I currently have two applications servers each wit a Rails api connecting to PostgreSQL via the ruby-pg gem. Both application server also have sidekiq running backgrou

Quickly add multiple items (1000 / sec) to a lateral queue?

I realize there is a push_bulk option for sidekiq but I'm currently being limited by latency to redis, so passing multiple items via push_bulk still isn't going quickly enough (only about 50/s). I've tried to increase the number of redis connections

Sidekiq processing with local redis but not with remote

I have a RoR app with background jobs using whenever and sidekiq gems. In development environment when I launch sidekiq with local redis instance (on localhost) the job keeps getting executed without problems. But when I switch to a remote redis inst

Sidekiq VS Thread.new to send an e-mail on the rails 4

I'm currently using Sidekiq as a solution to send email asynchronously on Rails 4. But now that Rails is Threadsafe by default, is this a good solution to replace Sidekiq by a new Thread ? Is that solution safe or inappropriate ? Thanks JDRails 4 bei

Rails upload directly to s3 in the background

I want the following workflow: visit /projects/new attach 1GB video file click 'submit' video file uploads to S3 in background while user browses rest of site I've been using S3_file_field gem up intil now, which lets me upload directly to S3. But my

Use Puma and Sidekiq in a Rails backend application

I have a backend Rails server with Sidekiq, which serves as API server. The app works as follow: My Rails server receives many requests from incoming API clients at the same time. For each of these requests, the Rails server will allocate jobs to a S

Start of work Sidekiq queue on the Rails application

I need to add a job to the Sidekiq queue when my Rails app starts, to update some data, but I don't know where is the best place to do it. Right now, I've wrote this on my application.rb: class Application < Rails::Application config.after_initialize

How to reset my sidekiq counters?

In my sidekiq dashboard, I see on the left a box with the counters Processed 168 Failed 111 Busy 0 Scheduled 0 Retries 0 Enqueued 0 How do I reset them all to 0?To reset processed jobs: Sidekiq.redis {|c| c.del('stat:processed') } and to reset failed

Sidekiq deploy in multiple environments

(See below for my detailed config, which is the result of Henley Chiu's answer). I've been trying to wrap my brain around Sidekiq deploys, and I am not really getting it. I have an app with a staging environment, and a production environment, on the