sidekiq

Rails: Starting Sidekiq on Heroku

我的梦境 提交于 2019-11-28 16:40:55
I'm having a problem getting Sidekiq up and running on my Heroku deployed Rails app. I have my app working fine in development (and on Heroku without Sidekiq). I created a Procfile with: worker: bundle exec sidekiq If I run heroku ps , the only process I see is web.1 . Should I see one for Sidekiq? I do get an error: Redis::CannotConnectError (Error connecting to Redis on localhost:6379) in my Heroku logs. UPDATE: Found I probably needed heroku addons:add redistogo . Still not working. I feel I'm missing some basic configuration. Is there something I need to do to get Redis up and running for

failed with error 10068: “invalid operator: $oid”

青春壹個敷衍的年華 提交于 2019-11-28 07:21:39
问题 just updated to the latest version of mongoid (3.1.0) and sidekiq (2.7.2) now i'm getting the error : failed with error 10068: "invalid operator: $oid" from looking into the code i see a select like that: @selector={"_id"=>{"$oid"=>"[some id]"}} what can get wrong here? 回答1: adding this to my gemfile fixed the issue: gem 'multi_json', '1.5.1' i guess something is wrong with the latest version (1.6.0) EDIT: the gem has been updated to new version (1.6.1) that fixed this issue. more here: https

how to delete a job in sidekiq

本秂侑毒 提交于 2019-11-28 04:07:51
I am using sidekiq in my rails app. Users of my app create reports that start a sidekiq job. However, sometimes users want to be able to cancel "processing" reports. Deleting the report is easy but I also need to be able to delete the sidekiq job as well. So far I have been able to get a list of workers like so: workers = Sidekiq::Workers.new and each worker has args that include a report_id so I can identify which job belongs to which report. However, I'm not sure how to actually delete the job. It should be noted that I want to delete the job whether it is currently busy, or set in retry.

Rails: Cancelling a scheduled job in Sidekiq

笑着哭i 提交于 2019-11-27 21:31:25
问题 So I have a Sidekiq worker in my model which looks like this: class Perk < ActiveRecord::Base include Sidekiq::Worker include Sidekiq::Status::Worker after_save :update_release_time def update_release_time if self.release_time_changed? #if scheduled job already exists then cancel and reschedule # Sidekiq::Status.cancel scheduled_job_id # scheduled_job_id = NotifierWorker.perform_at(time.seconds.from_now, .....) #elsif scheduled job doesn't exist, then schedule for the first time # scheduled

Sidekiq: Ensure all jobs on the queue are unique

坚强是说给别人听的谎言 提交于 2019-11-27 20:25:05
问题 I have some update triggers which push jobs onto the Sidekiq queue. So in some cases, there can be multiple jobs to process the same object. There are a couple of uniqueness plugins ("Middleware", Unique Jobs), they're not documented much, but they seem to be more like throttlers to prevent repeat processing ; what I want is a throttler that prevents repeat creating of the same jobs. That way, an object will always be processed in its freshest state. Is there a plugin or technique for this?

Get sidekiq to execute a job immediately

我的梦境 提交于 2019-11-27 14:17:51
问题 At the moment, I have a sidekiq job like this: class SyncUser include Sidekiq::Worker def perform(user_id) #do stuff end end I am placing a job on the queue like this: SyncUser.perform_async user.id This all works of course but there is a bit of a lag between calling perform_async and the job actually getting executed. Is there anything else I can do to tell sidekiq to execute the job immediately? 回答1: There are two questions here. If you want to execute a job immediately, in the current

Sidekiq not deallocating memory after workers have finished

≯℡__Kan透↙ 提交于 2019-11-27 12:48:26
问题 I have about six Sidekiq worker which perform JSON crawling . Dependent on the endpoint's dataset size they finish between 1min and 4h. Especially, watching the long one, which takes 4h, I see a very slight increase of memory over time. It's not a problem, until I want to schedule the same worker jobs again. The memory is not deallocated and stacks up, until I run into the Linux OOM Killer which gets rid of my Sidekiq process. Memory leak ? I watched the number of different objects in

Redis raise error: NOAUTH Authentication required but there is no password setting

拈花ヽ惹草 提交于 2019-11-27 12:19:50
问题 I got error NOAUTH Authentication required when I connect to Redis server via command: redis-cli and run ping to check if Redis is working. I found answer for NOAUTH Authentication required error which describes that this error only happens when Redis is set a password, but I checked Redis config file at etc/redis/redis.conf and there is no password setting. Does anyone know that if there are other settings which can cause this error? Thanks for any help. p/s: I am using Ruby on Rails web

Resque vs Sidekiq? [closed]

和自甴很熟 提交于 2019-11-27 10:09:09
I am currently using Resque for my background process but recently I heard a lot of huff-buff about sidekiq . Could anybody compare/differentiate? In particular I would like to know is there a way to monitor programmatically whether a job is completed in sidekiq Resque: Pros: does not require thread safety (works with pretty much any gem out there); has no interpreter preference (you can use any ruby); Resque currently supports MRI 2.3.0 or later loads of plugins. Cons runs a process per worker (uses more memory); does not retry jobs (out of the box, anyway). Sidekiq: Pros runs thread per

Rails: Starting Sidekiq on Heroku

强颜欢笑 提交于 2019-11-27 09:45:18
问题 I'm having a problem getting Sidekiq up and running on my Heroku deployed Rails app. I have my app working fine in development (and on Heroku without Sidekiq). I created a Procfile with: worker: bundle exec sidekiq If I run heroku ps , the only process I see is web.1 . Should I see one for Sidekiq? I do get an error: Redis::CannotConnectError (Error connecting to Redis on localhost:6379) in my Heroku logs. UPDATE: Found I probably needed heroku addons:add redistogo . Still not working. I feel