diff options
author | David Arthur <mumrah@gmail.com> | 2013-05-28 06:39:42 -0700 |
---|---|---|
committer | David Arthur <mumrah@gmail.com> | 2013-05-28 06:39:42 -0700 |
commit | 904157ba2c33702fed48ce12ee54d80cfc71c606 (patch) | |
tree | dc13245cd18c0f3b12c0374ac5a7b07b391c2823 /kafka/util.py | |
parent | 6327ba38bcc799b948a8f723ea2e6f078f8e90a8 (diff) | |
parent | 8fc0407498b7167244501607f1003b294c694858 (diff) | |
download | kafka-python-904157ba2c33702fed48ce12ee54d80cfc71c606.tar.gz |
Merge pull request #23 from mahendra/autocommit
Auto commit timer is not periodic
Diffstat (limited to 'kafka/util.py')
-rw-r--r-- | kafka/util.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kafka/util.py b/kafka/util.py index 5dc6bc2..8c02cb2 100644 --- a/kafka/util.py +++ b/kafka/util.py @@ -71,13 +71,12 @@ class ReentrantTimer(object): self.fn = fn def start(self): - if self.timer is None: - self.timer = Timer(self.t / 1000., self.fn) - self.timer.start() - else: + if self.timer is not None: self.timer.cancel() - self.timer = Timer(self.t / 1000., self.fn) - self.timer.start() + + self.timer = Timer(self.t / 1000., self.fn) + self.timer.start() def stop(self): self.timer.cancel() + self.timer = None |