|
|
|
@ -308,12 +308,21 @@ class Bureau(object):
|
|
|
|
|
# register commands and api methods
|
|
|
|
|
self._publish_methods()
|
|
|
|
|
|
|
|
|
|
poller = zmq.Poller()
|
|
|
|
|
poller.register(self._recv, zmq.POLLIN)
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
try:
|
|
|
|
|
msg = self._recv.recv_string(flags=zmq.NOBLOCK)
|
|
|
|
|
except zmq.ZMQError:
|
|
|
|
|
time.sleep(0.05) # don't waste CPU
|
|
|
|
|
continue
|
|
|
|
|
msgs = dict(poller.poll(500))
|
|
|
|
|
if msgs:
|
|
|
|
|
if msgs.get(self._recv) == zmq.POLLIN:
|
|
|
|
|
msg = self._recv.recv_string(flags=zmq.NOBLOCK)
|
|
|
|
|
else:
|
|
|
|
|
continue
|
|
|
|
|
# msg = self._recv.recv_string(flags=zmq.NOBLOCK)
|
|
|
|
|
#except zmq.ZMQError:
|
|
|
|
|
# time.sleep(0.05) # don't waste CPU
|
|
|
|
|
# continue
|
|
|
|
|
try:
|
|
|
|
|
self.log.debug("got message:" + msg)
|
|
|
|
|
dot = msg.find(".")
|
|
|
|
|