How to kill reske workers on Hereka?

I use this guide to install Resque with Redis http://blog.redistogo.com/2010/07/26/resque-with-redis-to-go/

Everything is set up for me, and when I put something, it appears in my resque queue. This is for the hero, so I'm running

heroku rake resque:work QUEUE=* (in /app) Starting the New Relic Agent. Installed New Relic Browser Monitoring middleware Connected to NewRelic Service at collector-1.newrelic.com:80 ^C [canceled] 

Then it completes the job, but now the worker is still there. How to remove / kill a worker?

I currently have this 0 of 4 Workers Working I want to make the worker simply delete himself after completing tasks in the queue. How would I continue to do this or is there another heroku terminal command that I need to call.

Also, do resque workers cost money on a hero? I just want to make it so that I can manually run tasks in my resque queue. I do not need this to be done automatically.

+4
source share
4 answers

I know this is an old question, but you can do it from the console:

 $ heroku run console irb(main):001:0> Resque.working[0].id => "09ec127d-bb90-4629-a6f2-bb2610885ab5:62:*" irb(main):002:0> Resque.working.length => 28 irb(main):003:0> Resque.remove_worker("09ec127d-bb90-4629-a6f2-bb2610885ab5:62:*") => 0 irb(main):004:0> Resque.working.length => 27 irb(main):005:0> 

I have not tried it yet, but there is also a gem for this manually , it seems that you want to automate it, though.

+9
source

To integrate the hero with the workers, you need to complete a rake task called jobs: work. To get this working with resque, you need to add the following task to the rake file (taken from http://blog.redistogo.com/2010/07/26/resque-with-redis-to-go/ ):

 require 'resque/tasks' task "resque:setup" => :environment do ENV['QUEUE'] = '*' end desc "Alias for resque:work (To run workers on Heroku)" task "jobs:work" => "resque:work" 

To start an individual worker on a hero, use:

 ? heroku workers 1 

To disable background workers, follow these steps:

 ? heroku workers 0 

To use 5 workers, follow these steps:

 ? heroku workers 5 

Geroku blames you for the second for every worker you run. If you enter the hero, you can see how much your current number of employees will cost on the resources page of your application.

+3
source

In Heocu Cedar Stack, this is quite simple, it is a command to change the number of workers to n , you will run this command, and this will kill / create workers to reach n .

 heroku ps:scale worker=n --app your-app-name 

See this Heroku article for more details: https://devcenter.heroku.com/articles/scaling

+1
source

Have you tried HireFire ?

It is specifically designed to increase the up / down of Resque (and Delayed Job) workers at Heroku.

0
source

All Articles