Class: Nervion::ReconnectionScheduler

Inherits:
Object
  • Object
show all
Defined in:
lib/nervion/reconnection_scheduler.rb

Constant Summary collapse

HTTP_ERROR_LIMIT =
10
NETWORK_ERROR_LIMIT =
65

Instance Method Summary collapse

Constructor Details

#initializeReconnectionScheduler

Returns a new instance of ReconnectionScheduler.



8
9
10
11
12
13
# File 'lib/nervion/reconnection_scheduler.rb', line 8

def initialize
  @http_errors = ErrorCounter.new(HTTP_ERROR_LIMIT)
  @network_errors = ErrorCounter.new(NETWORK_ERROR_LIMIT)
  @http_wait_calculator = HttpWaitCalculator.new
  @network_wait_calculator = NetworkWaitCalculator.new
end

Instance Method Details

#reconnect_after_http_error_in(stream) ⇒ Object



15
16
17
# File 'lib/nervion/reconnection_scheduler.rb', line 15

def reconnect_after_http_error_in(stream)
  reconnect_after_error stream, @http_errors, @http_wait_calculator
end

#reconnect_after_network_error_in(stream) ⇒ Object



19
20
21
# File 'lib/nervion/reconnection_scheduler.rb', line 19

def reconnect_after_network_error_in(stream)
  reconnect_after_error stream, @network_errors, @network_wait_calculator
end