7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/lhm/throttler/backoff_reduction.rb', line 7
def initialize(options = {})
@backoff_reduction_factor = options[:backoff_reduction_factor] || DEFAULT_BACKOFF_REDUCTION_FACTOR
@min_stride_size = options[:min_stride_size] || MIN_STRIDE_SIZE
if @backoff_reduction_factor >= 1 || @backoff_reduction_factor <= 0
raise ArgumentError, 'backoff_reduction_factor must be between greater than 0, and less than 1'
end
if @min_stride_size < 1
raise ArgumentError, 'min_stride_size must be an integer greater than 0'
end
if !@min_stride_size.is_a?(Integer)
raise ArgumentError, 'min_stride_size must be an integer'
end
if @min_stride_size > @stride
raise ArgumentError, 'min_stride_size must be less than or equal to stride'
end
end
|