sidekiq

Circular dependency when Starting Sidekiq Queue

不羁岁月 提交于 2019-12-06 09:29:15
I get the following error when loading a sidekiq queue: RuntimeError: Circular dependency detected while autoloading constant FileProcessor /Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:492:in `load_missing_constant' /Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing' /Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:526:in `load_missing_constant' /Users/johnmcauley/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.0/lib/active

Reduce the execution time of jobs of sidekiq

我的未来我决定 提交于 2019-12-06 09:29:06
I am currently working on an app which involves syncing of contacts on rails server. I am using redis server and sidekiq for performing contact syncing in the background. My database is mongodb and I am using mongoid gem as ORM. Workflow is a follows: Contacts on the phone are passed to the rails server through app and then on the rails server, it is queued in the redis server. Now cron job triggers sidekiq which connects to redis and completes the job. One Job of sidekiq is as follows: it has array of contacts(size upto 3000). It has to process each of these contacts. By processing I mean

daemonizing sidekiq with upstart script - is not working

坚强是说给别人听的谎言 提交于 2019-12-06 06:24:52
I'm trying to daemonize sidekiq using two upstart scripts following this example. Basically the workers service starts a fixed number of sidekiq services. The problem is that the sidekiq script fails at the line of code where I am starting sidekiq. I've tried to run the command directly in bash and it works fine. I tried all different commented lines and none works. So my question is what am I doing wrong? Where can I see the error messages? This is my modified sidekiq script: # /etc/init/sidekiq.conf - Sidekiq config # This example config should work with Ubuntu 12.04+. It # allows you to

Rails how to tell if a sidekiq worker is done with perform_async

China☆狼群 提交于 2019-12-06 06:07:26
问题 I'm working on extrapolating an extensive background task to a sidekiq worker (first time working with sidekiq). I've been able to get this to run correctly. But I'm not sure how to check on the progress of the sidekiq worker - what's the best way to check to see if the worker is done with the perform_async function? AutoWorker sidekiq task: class AutoWorker include Sidekiq::Worker def perform(lead_id, cars) logger.info "WORKER CREATED" lead = Lead.find(lead_id) response = ZipCodeCheck.new

NameError: uninitialized constant Mail::Parsers::ContentTransferEncodingParser

久未见 提交于 2019-12-06 04:22:58
问题 Sometimes when I send mass email on heroku some of them fail with the following error: NameError: uninitialized constant Mail::Parsers::ContentTransferEncodingParser I have no idea why is that but I think that maybe this maybe caused by using attachments.inline in mailer . Any ideas what may cause this problem? 回答1: I create initializer with following line: Mail.eager_autoload! if Rails.env.production? && defined?(Mail) and that fixes the problem. 来源: https://stackoverflow.com/questions

How to pass current_user to Sidekiq's Worker

谁说我不能喝 提交于 2019-12-06 03:01:56
I am trying to pass current_user or User.find(1) to a worker module but getting error in the sidekiq's dashboard (localhost:3000/sidekiq/retries): NoMethodError: undefined method `supports' for "#":String note: my relations are ok ie: u = User.find(1) u.supports #=> [] supports_controller.rb: def create @user = current_user ProjectsWorker.perform_async(@user) ... end app/workers/projects_worker.rb: class ProjectsWorker include Sidekiq::Worker def perform(user) u = user @support = u.supports.build(support_params) end end Re-starting my sidekiq server makes no difference. This is on my

Sidekiq list all jobs [queued + running]

强颜欢笑 提交于 2019-12-05 19:31:50
问题 Is there a way to get a list of all the jobs currently in the queue and running? Basically, I want to know if a job of given class is already there, I don't want to insert my other job. I've seen other option but I want to do it this way. I can see here how to get the list of jobs in the queue. queue = Sidekiq::Queue.new("mailer") queue.each do |job| job.klass # => 'MyWorker' end from what I understand this will not include processing/running jobs. Any way to get them? 回答1: if you want to

Log to different logger based on call from Sidekiq or Rails

自古美人都是妖i 提交于 2019-12-05 18:20:37
问题 I have an Rails 3.2 based app that uses Sidekiq 2.12 to run background jobs. The Sidekiq jobs can call the same methods as the interactive Rails app. I would like the methods to log to the Sidekiq log when called from Sidekiq and log to the Rails log when called from Rails. I am looking for a clean way to do this but so far have come up empty. In both environments, both Sidekiq::Logging.logger and Rails.logger are defined and work. I do not want to inspect the call stack on every logging

Configuring Puma and Sidekiq

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 16:23:43
Might be more of trying to overcome a learning curve + actual code question. I apologize if it seems nubish, currently I get this error within production. Basically I keep recieving this "redis pool is too small" and I'm lost where to start, I'm actually lost on basically understanding how to accurately configure sidekiq with puma or anything that comes after configuration like scaling etc. Below I have my configuration followed my error I recieve . ProcFile web: bundle exec puma -C config/puma.rb worker: bundle exec sidekiq -e production -C config/sidekiq.yml Sidekiq init if Rails.env

Rails Heroku Sidekiq Confirm Procfile is Working

情到浓时终转凉″ 提交于 2019-12-05 14:09:54
I have set my Procfile in the root of my app: web: bundle exec thin start -p $PORT worker: bundle exec sidekiq -c 5 -v and I can see that heroku sees it when I push my rails app up via git push heroku master Procfile declares types -> web, worker The problem is that a bunch of jobs are just getting stuck in the "enqueue" section. If I run heroku run bundle exec sidekiq from the command line, only then will the jobs process. Any ideas on how I could debug this? Thanks! Have you started worker dynos? Heroku will only start the web process type automatically for you. Check the output of heroku ps