lib/workless/scalers/heroku.rb in workless-0.2.0 vs lib/workless/scalers/heroku.rb in workless-1.0.0

- old
+ new

@@ -4,30 +4,24 @@ module Workless module Scaler class Heroku < Base - require "heroku" + extend Delayed::Workless::Scaler::HerokuClient - def up - client.set_workers(ENV['APP_NAME'], 1) if workers == 0 + def self.up + client.set_workers(ENV['APP_NAME'], 1) if self.workers == 0 end - def down - client.set_workers(ENV['APP_NAME'], 0) unless workers == 0 or jobs.count > 0 + def self.down + client.set_workers(ENV['APP_NAME'], 0) unless self.workers == 0 or self.jobs.count > 0 end - def workers + def self.workers client.info(ENV['APP_NAME'])[:workers].to_i end - private - - def client - @client ||= ::Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASSWORD']) - end - end end end -end \ No newline at end of file +end