lib/marionette/master.rb in marionette-0.0.5 vs lib/marionette/master.rb in marionette-0.0.6

- old
+ new

@@ -25,10 +25,23 @@ # Stands by for the next msg from puppet # Processes and returns response def receive - # Stand by for a response + # Poll server until it is receive-able + poller = ZMQ::Poller.new + poller.register_readable @socket + + while true do + + poll_reply = poller.poll 500 + key = poll_reply.keys.first # fetch the first and only hash key + + break if poll_reply[key][:revents] == 1 # fetch revents + + end + + # Receive message begin response = socket.recv_string @response = Marshal.load(response)