Class: Rage::Configuration::Deferred::Backpressure

Inherits:
Object
  • Object
show all
Defined in:
lib/rage/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(high_water_mark = nil, low_water_mark = nil, timeout = nil) ⇒ Backpressure

Returns a new instance of Backpressure.



425
426
427
428
429
430
431
432
# File 'lib/rage/configuration.rb', line 425

def initialize(high_water_mark = nil, low_water_mark = nil, timeout = nil)
  @high_water_mark = high_water_mark || 1_000
  @low_water_mark = low_water_mark || (@high_water_mark * 0.8).round

  @timeout = timeout || 2
  @sleep_interval = 0.05
  @timeout_iterations = (@timeout / @sleep_interval).round
end

Instance Attribute Details

#high_water_markObject (readonly)

Returns the value of attribute high_water_mark.



423
424
425
# File 'lib/rage/configuration.rb', line 423

def high_water_mark
  @high_water_mark
end

#low_water_markObject (readonly)

Returns the value of attribute low_water_mark.



423
424
425
# File 'lib/rage/configuration.rb', line 423

def low_water_mark
  @low_water_mark
end

#sleep_intervalObject (readonly)

Returns the value of attribute sleep_interval.



423
424
425
# File 'lib/rage/configuration.rb', line 423

def sleep_interval
  @sleep_interval
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



423
424
425
# File 'lib/rage/configuration.rb', line 423

def timeout
  @timeout
end

#timeout_iterationsObject (readonly)

Returns the value of attribute timeout_iterations.



423
424
425
# File 'lib/rage/configuration.rb', line 423

def timeout_iterations
  @timeout_iterations
end