class EM::Protocols::Zmq2::ReqFiber

Public Instance Methods

send_request(data, &blk) click to toggle source
Calls superclass method
# File lib/map_reduce/socket/req_fiber.rb, line 3
def send_request(data, &blk)
  fib = Fiber.current
  timer = nil
  request_id = super(data) do |message|
    EM.cancel_timer(timer)
    fib.resume(message)
  end
  if request_id
    timer = EM.add_timer(10) {
      MapReduce.logger.info("TIMEOUT")
      cancel_request(request_id)
    }
  end
  if block_given?
    blk.call Fiber.yield
  else
    Fiber.yield
  end
end