Class: Monga::Connections::FiberedConnection
- Inherits:
-
EMConnection
- Object
- EM::Connection
- EMConnection
- Monga::Connections::FiberedConnection
- Defined in:
- lib/monga/connections/fibered_connection.rb
Instance Attribute Summary
Attributes inherited from EMConnection
Instance Method Summary collapse
Methods inherited from EMConnection
#close, connect, #connected?, #connection_completed, #initialize, #is_master?, #primary?, #receive_data, #reconnect, #unbind
Constructor Details
This class inherits a constructor from Monga::Connections::EMConnection
Instance Method Details
#send_command(msg, request_id = nil, &cb) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/monga/connections/fibered_connection.rb', line 9 def send_command(msg, request_id=nil, &cb) fib = Fiber.current reconnect unless @connected callback do send_data msg end if cb reconnect unless @connected @responses[request_id] = fib res = Fiber.yield raise res if Exception === res cb.call(res) end end |