Sha256: 48ac5784348842ecc198d0538eb9604dc317c40caca8f7fa25ece1f5117b68d7

Contents?: true

Size: 515 Bytes

Versions: 9

Compression:

Stored size: 515 Bytes

Contents

require 'rush'

module Delayed
  module Workless
    module Scaler

      class Local < Base

        def up
          Rush::Box.new[Rails.root].bash("rake jobs:work", :background => true)
          true
        end

        def down
          Rush::Box.new.processes.filter(:cmdline => /rake jobs:work/).kill unless workers == 0 or jobs.count > 0
          true
        end

        def workers
          Rush::Box.new.processes.filter(:cmdline => /rake jobs:work/).size
        end

      end
  
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
workless-0.0.9 lib/workless/scalers/local.rb
workless-0.0.8 lib/workless/scalers/local.rb
workless-0.0.7 lib/workless/scalers/local.rb
workless-0.0.6 lib/workless/scalers/local.rb
workless-0.0.5 lib/workless/scalers/local.rb
workless-0.0.4 lib/workless/scalers/local.rb
workless-0.0.3 lib/workless/scalers/local.rb
workless-0.0.2 lib/workless/scalers/local.rb
workless-0.0.1 lib/workless/scalers/local.rb