Sha256: a66aeace72c467832525170579e03b2f8c7b70c851bc73bb1f022e4c9f6b9d9c

Contents?: true

Size: 593 Bytes

Versions: 7

Compression:

Stored size: 593 Bytes

Contents

module Oxidized
  class Jobs < Array
    attr_accessor :interval, :duration, :max, :want
    def initialize max, interval, nodes
      @max       = max
      #@interval  = interval * 60
      @interval  = interval
      @nodes     = nodes
      @duration  = 4
      new_count
      super()
    end
    def duration last
      @duration = (@duration + last) / 2
      new_count
    end
    def new_count
      @want = ((@nodes.size * @duration) / @interval).to_i
      @want = 1 if @want < 1
      @want = @nodes.size if @want > @nodes.size
      @want = @max if @want > @max
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
oxidized-0.3.0 lib/oxidized/jobs.rb
oxidized-0.2.4 lib/oxidized/jobs.rb
oxidized-0.2.3 lib/oxidized/jobs.rb
oxidized-0.2.2 lib/oxidized/jobs.rb
oxidized-0.2.1 lib/oxidized/jobs.rb
oxidized-0.2.0 lib/oxidized/jobs.rb
oxidized-0.1.1 lib/oxidized/jobs.rb