Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

QueueClassic autoscale heroku workers

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 heroku-qc-autoscale.gemspec
README.md

Autoscale QueueClassic workers on Heroku

Add to a Rails 3.x project to auto scale QueueClassic workers on heroku.

WARNING: USE AT OWN RISK! THIS GEM IS CONSIDERED EXTREME ALPHA!

Build Status Code Climate

Usage

Install as gem

gem install heroku-qc-autoscale

Add to Gemfile

gem "heroku-qc-autoscale"

Create config/initializers/qc_autoscale.rb

Autoscale.config do |c|
  c.api_key = ENV['HEROKU_API_KEY']
  c.app     = ENV['AUTOSCALE_APP']
  c.min     = ENV['AUTOSCALE_MIN']
  c.scale   = [1, 15, 30, 40, 50]
end

Autoscale.activate! if Rails.env.production?

Queue jobs as normal with QueueClassic. Based on your scale table, it will recalculate the workers required after each QC#enqueue, and QC#delete.

QC.enqueue("Time.now")

TODO

  • remove Rails dependencies
  • remove ActiveSupport dependencies
  • when queue is emptied, scale workers to "min" after X time elapses.
  • rake task to scale workers to "min" manually
  • enable/disable scaling at runtime

Meta

Released under the MIT license.

Something went wrong with that request. Please try again.