From 10d273b3feee216ea711689004454e87c3b237bc Mon Sep 17 00:00:00 2001 From: Eric Seidler Date: Mon, 30 Jan 2017 21:28:48 -0600 Subject: [PATCH] use non-blocking eventlet zmq wrapper in listen method --- socketio/zmq_manager.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/socketio/zmq_manager.py b/socketio/zmq_manager.py index 2ad79ce..3950655 100644 --- a/socketio/zmq_manager.py +++ b/socketio/zmq_manager.py @@ -1,9 +1,8 @@ -import time import pickle import re try: - import zmq + import eventlet.green.zmq as zmq except ImportError: zmq = None @@ -92,12 +91,9 @@ class ZmqManager(PubSubManager): # pragma: no cover def zmq_listen(self): while True: - try: - response = self.sub.recv(flags=zmq.NOBLOCK) - if response is not None: - yield response - except zmq.Again: - time.sleep(0.5) + response = self.sub.recv() + if response is not None: + yield response def _listen(self): for message in self.zmq_listen():