sidekiq

Setting Sidekiq :concurrency on Heroku

白昼怎懂夜的黑 提交于 2019-12-04 13:46:18
问题 I'm having trouble figuring out how exactly concurrency works on Heroku, and how to go about setting the optimal :concurrency value for Sidekiq Here's the set up - Puma Web Server 2 workers 5 threads Heroku Dynos 8 web dynos 2 "worker" dynos (These will run Sidekiq, not to be confused with Puma Workers) DB Connections 120 Max Connections Allowed by Postgres 5 Active Record Pool Size (default) ?? Sidekiq :concurrency value Each Puma worker is allowed the default 5 ActiveRecord DB connections

Sidekiq and rails 4 actionmailer never delivers emails

人盡茶涼 提交于 2019-12-04 09:15:35
问题 I've setup sidekiq in a rails 4 application for sending emails and processing background jobs. I have also devise which I am using devise_async and a typical contact form emailer. I am using gmail for sending emails. If I remove sidekiq, it sends the emails normally through gmail (both devise and contact form) but when I am enabling it, it doesn't work (neither devise_async neither contact form). Sidekiq shows that the background jobs starts and finishes successfully (I also see them through

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

寵の児 提交于 2019-12-04 09:03:35
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(cars: cars, lead: lead).execute end end called from my controller: def update respond_to do |format| if

Work with two separate redis instances with sidekiq?

喜欢而已 提交于 2019-12-04 08:35:47
问题 Good afternoon, I have two separate, but related apps. They should both have their own background queues (read: separate Sidekiq & Redis processes) . However, I'd like to occasionally be able to push jobs onto app2 's queue from app1 . From a simple queue/push perspective, it would be easy to do this if app1 did not have an existing Sidekiq/Redis stack: # In a process, far far away # Configure client Sidekiq.configure_client do |config| config.redis = { :url => 'redis://redis.example.com:7372

How to run sidekiq in production server?

青春壹個敷衍的年華 提交于 2019-12-04 07:29:28
问题 I have a server with apache + passenger. How will I run sidekiq in production? Any configuration needed to run the bundle exec sidekiq Thanks 回答1: bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml -e production -d , Daemonize process -L , path to writable logfile -C , path to YAML config file -e , Application environment 回答2: A better solution than using the daemonization -d flag is to leverage the process supervisor provided by your OS. This is also the recommendation given by

How to perform a Sidekiq callback when a group of workers are complete

旧巷老猫 提交于 2019-12-04 06:44:34
Lets say I have a Sidekiq task that processes products to my database. Each product is grouped by store, so an overly simplified example of my code would be something like this... stores.each do |store| store.products.each do |product| ProductWorker.perform_async(product.id) end end When all the products from one store have run. I'd like to update the stores last_updated column with the current time. But only when the last task for that store has run. How can I achieve this? This is exactly what Sidekiq Pro's Batches feature is designed to solve: https://github.com/mperham/sidekiq/wiki/Batches

Sidekiq list all jobs [queued + running]

怎甘沉沦 提交于 2019-12-04 02:32:21
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? if you want to list all currently running jobs from console, try this workers = Sidekiq::Workers.new workers.each do |_process

sidekiq to cancel list to scheduled jobs

十年热恋 提交于 2019-12-04 00:02:47
I have several scheduled jobs running like this: MyWorker.perform_at(3.hours.from_now, 'mike', 1) I am wondering, if later, say an hour later, I feel like I want to cancel this job, how would I go about doing that? I've recently written a bit of code to handle this, it's available in my branch of the sidekiq-status gem. You can view it, or use it here: https://github.com/Robinson7D/sidekiq-status (You would have to use that as the git: information in the gemfile, currently, until the main fork of the project implements this) To use it, first you store the job_identifier: job_identifier =

Can multiple sidekiq instances process the same queue

≡放荡痞女 提交于 2019-12-03 22:19:15
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 from a queue? UPDATE: I need to know if there is a possible conflict, when running Sidekiq on more than 1 machine Yes, sidekiq can absolutely run many processes against the same queue. Redis will just give the message to a random process. Nope, I've ran Sidekiqs in different machines with no issues. Each of the Sidekiqs read from the same redis

Using CarrierWave with Amazon Elastic Transcoder in a Rails app

半城伤御伤魂 提交于 2019-12-03 20:14:55
I asked two additional questions before this on Stack Overflow, but got very little help and I thought I would ask an open question for posterity. I have spent time parsing the AWS-SDK API docs and found very little direct answers to my needs. I have also posted on the AWS forums and haven't been able to get a good response there. A simple, comprehensive, step-by-step solution seems impossible to find. What I have completed: Uploading with CarrierWave direct to s3. I followed Railscast #383 and adapted it to my needs. I am able to "retrieve" my files from my s3 bucket. Details about what I've