Class: Oxidized::Jobs

Inherits:
Array
  • Object
show all
Defined in:
lib/oxidized/jobs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max, interval, nodes) ⇒ Jobs

Returns a new instance of Jobs.



4
5
6
7
8
9
10
11
12
# File 'lib/oxidized/jobs.rb', line 4

def initialize max, interval, nodes
  @max       = max
  #@interval  = interval * 60
  @interval  = interval
  @nodes     = nodes
  @duration  = 4
  new_count
  super()
end

Instance Attribute Details

#duration(last) ⇒ Object

Returns the value of attribute duration.



3
4
5
# File 'lib/oxidized/jobs.rb', line 3

def duration
  @duration
end

#intervalObject

Returns the value of attribute interval.



3
4
5
# File 'lib/oxidized/jobs.rb', line 3

def interval
  @interval
end

#maxObject

Returns the value of attribute max.



3
4
5
# File 'lib/oxidized/jobs.rb', line 3

def max
  @max
end

#wantObject

Returns the value of attribute want.



3
4
5
# File 'lib/oxidized/jobs.rb', line 3

def want
  @want
end

Instance Method Details

#new_countObject



17
18
19
20
21
22
# File 'lib/oxidized/jobs.rb', line 17

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