summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2015-02-03 12:33:58 -0800
committerDana Powers <dana.powers@gmail.com>2015-02-03 12:33:58 -0800
commitfa41ec6da70a3cbcfdd17720f35d692d7708bed9 (patch)
tree6b49691645ec01fcef1427f8e58ec77c332f3f00
parentf0f37445b483b413cfe1ec900d033a3c9325e6e9 (diff)
parenta21f701e1e794b21c307df4d4391f3600917bc66 (diff)
downloadkafka-python-fa41ec6da70a3cbcfdd17720f35d692d7708bed9.tar.gz
Merge pull request #312 from dpkp/reentrant_timer_py26
Fix python2.6 threading.Event bug in ReentrantTimer
-rw-r--r--kafka/util.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/kafka/util.py b/kafka/util.py
index cc5c0d5..14d2b2c 100644
--- a/kafka/util.py
+++ b/kafka/util.py
@@ -126,7 +126,11 @@ class ReentrantTimer(object):
self.active = None
def _timer(self, active):
- while not active.wait(self.t):
+ # python2.6 Event.wait() always returns None
+ # python2.7 and greater returns the flag value (true/false)
+ # we want the flag value, so add an 'or' here for python2.6
+ # this is redundant for later python versions (FLAG OR FLAG == FLAG)
+ while not (active.wait(self.t) or active.is_set()):
self.fn(*self.args, **self.kwargs)
def start(self):