Method: AbstractThriftClient#connect!
- Defined in:
- lib/thrift_client/abstract_thrift_client.rb
#connect!(method = nil) ⇒ Object
Force the client to connect to the server. Not necessary to be called as the connection will be made on the first RPC method call.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/thrift_client/abstract_thrift_client.rb', line 99 def connect!(method = nil) start_time ||= Time.now @current_server = next_live_server @client = @current_server.client @last_client = @client do_callbacks(:post_connect, self) rescue IOError, Thrift::TransportException disconnect!(true) timeout = timeout(method) if timeout && Time.now - start_time > timeout no_servers_available! else retry end end |