Sha256: 2bff2769a04522ae9e60b11128fa6ca2f2cbcbb132ddcca7de262c809d4b3567

Contents?: true

Size: 620 Bytes

Versions: 7

Compression:

Stored size: 620 Bytes

Contents

require 'heroku'

module Delayed
  module Workless
    module Scaler

      class Heroku < Base

        extend Delayed::Workless::Scaler::HerokuClient

        def self.up
          nw = self.calculate_num_workers
          client.set_workers(ENV['APP_NAME'], nw) if nw
        rescue          
        end

        def self.down
          nw = self.calculate_num_workers
          client.set_workers(ENV['APP_NAME'], nw) unless self.workers == 0 or self.jobs.count > 0
        rescue
        end

        def self.workers
          client.info(ENV['APP_NAME'])[:workers].to_i
        end

      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rcarvalho-workless-1.0.2.13 lib/workless/scalers/heroku.rb
rcarvalho-workless-1.0.2.12 lib/workless/scalers/heroku.rb
rcarvalho-workless-1.0.2.11 lib/workless/scalers/heroku.rb
rcarvalho-workless-1.0.2.10 lib/workless/scalers/heroku.rb
rcarvalho-workless-1.0.2.9 lib/workless/scalers/heroku.rb
rcarvalho-workless-1.0.2.8 lib/workless/scalers/heroku.rb
rcarvalho-workless-1.0.2.7 lib/workless/scalers/heroku.rb