diff options
author | Mahendra M <mahendra.m@gmail.com> | 2013-05-28 11:51:57 +0530 |
---|---|---|
committer | Mahendra M <mahendra.m@gmail.com> | 2013-05-28 11:51:57 +0530 |
commit | 8fc0407498b7167244501607f1003b294c694858 (patch) | |
tree | dc13245cd18c0f3b12c0374ac5a7b07b391c2823 /kafka/util.py | |
parent | 6327ba38bcc799b948a8f723ea2e6f078f8e90a8 (diff) | |
download | kafka-python-8fc0407498b7167244501607f1003b294c694858.tar.gz |
Auto commit timer is not periodic
The auto commit timer is one-shot. After the first commit, it does
not fire again. This ticket fixes the issue.
Also, in util.ReentrantTimer(), some duplicate code was cleaned up
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 |