From 65f1174d83d46b98800984f36c42ea3c3ef163ca Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Tue, 18 Jan 2011 11:52:42 +0100 Subject: [PATCH] Redis: Consume now works with Eventlet --- kombu/utils/eventio.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kombu/utils/eventio.py b/kombu/utils/eventio.py index 984f319e..a6f49618 100644 --- a/kombu/utils/eventio.py +++ b/kombu/utils/eventio.py @@ -1,6 +1,11 @@ import select import socket +try: + from eventlet.patcher import is_monkey_patched as is_eventlet +except ImportError: + is_eventlet = lambda module: False + POLL_READ = 0x001 POLL_ERR = 0x008 | 0x010 | 0x2000 @@ -66,8 +71,12 @@ class _select(object): events[fd] = events.get(fd, 0) | POLL_ERR return events.items() - -if hasattr(select, "epoll"): +if is_eventlet(select): + # Eventlet ships with a monkey patched version of select.select + # we can use. + print("IS EVENTLET -> USING SELECT") + poll = _select +elif hasattr(select, "epoll"): # Py2.6+ Linux poll = select.epoll elif hasattr(select, "kqueue"):