Sha256: b55e7256aa882bf5e681e0b8c42139d7a7e836ce0ded83b1381611857b1bd57a
Contents?: true
Size: 617 Bytes
Versions: 11
Compression:
Stored size: 617 Bytes
Contents
module Gnip module GnipStream class ErrorReconnect def initialize(source_class, method_name) @source_class = source_class @method_name = method_name @reconnect_attempts = 0 end def attempt_to_reconnect(error_message) @error_message = error_message if @reconnect_attempts < 5 @reconnect_attempts +=1 sleep(2) @source_class.send(@method_name) else reconnect_failed_raise_error end end def reconnect_failed_raise_error raise @error_message end end end end
Version data entries
11 entries across 11 versions & 1 rubygems