Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Feb 17, 2012
  1. @bdotdub

    Change the way scalers are loaded

    bdotdub authored committed
    * Previously, the scaler needed to be defined and loaded from
      within the workless gem. Therefore, if you wanted to implement
      a new scaler, you'd have to fork and implement. Now, you can
      defined a scaler by putting it in the Delayed::Workless::Scaler
      module and you should be good to go
    * How this works technically:
      - The previous way was to require the scaler from within the gem
        directory, and then instantiate a new instance of the scaler
      - Now, the scalers only have class methods as "callbacks". Since
        the scalers aren't holding content (ie. instance variables),
        there's no need for the scalers to be instantiated
    * For scalers that need to talk to heroku, you need to extend the
      scaler to use Delayed::Workless::Scaler::HerokuClient
    * Example scaler:
    
        class Delayed::Workless::Scaler::SuperDuperRandom
    
          extend Delayed::Workless::Scaler::HerokuClient
    
          def self.up
            client.set_workers(ENV['APP_NAME'], rand(24)
          end
    
          def self.down
            client.set_workers(0)
          end
    
        end
Something went wrong with that request. Please try again.