Sha256: a30a0cd5d85f0bda138cffb0e15e6dd24355c1ddfb5123e490755f02ff6ffb68

Contents?: true

Size: 707 Bytes

Versions: 27

Compression:

Stored size: 707 Bytes

Contents

require 'rush'

module Delayed
  module Workless
    module Scaler

      class Local < Base

        def self.up
          if self.workers == 0
            Rush::Box.new[Rails.root].bash("script/delayed_job start -i workless", :background => true)
            sleep 1
          end
          true
        end

        def self.down
          unless jobs.count > 0 and workers > 0
            Rush::Box.new[Rails.root].bash("script/delayed_job stop -i workless", :background => true)
          end
          true
        end

        def self.workers
          Rush::Box.new.processes.filter(:cmdline => /delayed_job start -i workless|delayed_job.workless/).size
        end

      end
  
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
workless-1.2.0 lib/workless/scalers/local.rb
workless-1.1.3 lib/workless/scalers/local.rb
workless-1.1.2 lib/workless/scalers/local.rb
workless-1.1.1 lib/workless/scalers/local.rb
workless-1.1.0 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.21 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.20 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.19 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.18 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.17 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.16 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.15 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.14 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.13 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.12 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.11 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.10 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.9 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.8 lib/workless/scalers/local.rb
rcarvalho-workless-1.0.2.7 lib/workless/scalers/local.rb