sidekiq

Efficiently reschedule ActiveJob (resque/sidekiq)

老子叫甜甜 提交于 2019-12-03 19:33:04
I'm playing with Rails 4.2 app which uses ActiveJob backed by resque/sidekiq for email scheduling. When a user creates newsletter campaign a new job is created and scheduled on certain date. That's all great but what happens when the user changes the delivery date. In this case every job could check if it should be delivered or not thus invalid jobs would be ignored and only the last one would be executed. This could work but if a user would make 1k edits that would push 1k-1 invalid jobs into queue - not good. I believe that the existing job should be updated or replaced with a new one. As

How to control concurrency per queue?

那年仲夏 提交于 2019-12-03 17:51:58
问题 Sidekiq documentation suggests I can only control the global concurrency of sidekiq, rather than per queue. I am raising a question here with hope that there's a solution for a per-queue concurrency setting. Some 3rd party services just won't accept high concurrency, and limiting the entire sidekiq just for those is painful. I'm on sidekiq 3.3 回答1: Using Heroku I was able to control concurrency per queue by setting an environment variable in Procfile and then utilizing it in an sidekiq.rb

How to put sidekiq into Docker in a rails application?

拟墨画扇 提交于 2019-12-03 12:40:32
问题 I am using rails, sidekiq and docker. My docker-compose.yml file sidekiq: build: . command: bundle exec sidekiq -C config/sidekiq.yml links: - db - redis config/sidekiq.yml file :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: - default After I run docker-compose up , the sidekiq service can not start rightly. sidekiq_1 | No such file or directory @ rb_sysopen - /testapp/tmp/pids/sidekiq.pid sidekiq_1 | /usr/local/bundle/gems/sidekiq-3.5.3/lib/sidekiq/cli.rb:365:in

execute only one of many duplicate jobs with sidekiq?

不羁岁月 提交于 2019-12-03 12:34:09
I have a background job that does a map/reduce job on MongoDB. When the user sends in more data to the document, it kicks of the background job that runs on the document. If the user sends in multiple requests, it will kick off multiple background jobs for the same document, but only one really needs to run. Is there a way I can prevent multiple duplicate instances? I was thinking of creating a queue for each document and making sure it is empty before I submit a new job. Or perhaps I can set a job id somehow that is the same as my document id, and check that none exists before submitting it?

configure redis auth on sidekiq

六眼飞鱼酱① 提交于 2019-12-03 12:11:59
I think I am missing something since I couldn't find in the docs how to write the username and password for the redis instance to use with sidekiq.. Is there a way to do this? Or is it through ENV vars? Sidekiq passes unrecognized redis options directly to the Redis driver: config.redis = { password: 'bar' } And redis does not have the concept of users so there's only password. 来源: https://stackoverflow.com/questions/25970513/configure-redis-auth-on-sidekiq

Why is “❨╯°□°❩╯︵┻━┻” with such an encoding used for a method name?

≡放荡痞女 提交于 2019-12-03 10:49:55
问题 I came across following method in sidekiq gem. Its just invoked from test_sidekiq.rb. def self.❨╯°□°❩╯︵┻━┻ puts "Calm down, bro" end This is the only link I was able to find on SO. Google can't understand ❨╯°□°❩╯︵┻━┻ . Why doesn't Ruby complain about this encoding? What is the purpose of this method (not much looking at its body)? Why did author @mike-perham use this name? Just for fun, or testing some boundaries? 回答1: If you really do not understand the sense of the method name, that is a

Best way to monitor for completion of a Sidekiq job?

不羁岁月 提交于 2019-12-03 07:56:42
问题 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 is completed, but am unsure as to the best way to check for the job completion with Javascript. One possibility would be to configure the Sidekiq worker to set a cookie after the rest of the jobs are done. Then I can use a setTimeout function to

Jobs processing in background from web application

∥☆過路亽.° 提交于 2019-12-03 06:57:40
I want to schedule and run a lot of jobs in the background during a web application execution. The web app is built on top of Symfony 2 and Doctrine 2. I know the job-processing can be done with libraries like Resque or Sidekiq. However, these libraries and my application are written in different languages, so I am wondering how I can run Sidekiq jobs written in Ruby which should integrate with my app written in PHP. What I'm asking myself is if the only way to do this is rewriting a large amount of code to query the database from PHP to ruby, to be able to execute the job in Sidekiq/Resque.

How to control concurrency per queue?

这一生的挚爱 提交于 2019-12-03 06:57:14
Sidekiq documentation suggests I can only control the global concurrency of sidekiq, rather than per queue. I am raising a question here with hope that there's a solution for a per-queue concurrency setting. Some 3rd party services just won't accept high concurrency, and limiting the entire sidekiq just for those is painful. I'm on sidekiq 3.3 Using Heroku I was able to control concurrency per queue by setting an environment variable in Procfile and then utilizing it in an sidekiq.rb initializer: Sidekiq.configure_server do |config| config.options[:concurrency] = (ENV['SIDEKIQ_WORKERS_PROCFILE

Rails: How to restart sidekiq?

試著忘記壹切 提交于 2019-12-03 06:30:48
问题 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 process_id but it's not working. I want to know the command to restart sidekiq process. If you have any idea please share with me. I tried the below command also: sidekiqctl stop /path/to/pid file/pids/sidekiq.pid 回答1: So after you find you proces