From 8fc0407498b7167244501607f1003b294c694858 Mon Sep 17 00:00:00 2001 From: Mahendra M Date: Tue, 28 May 2013 11:51:57 +0530 Subject: 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 --- kafka/util.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'kafka/util.py') 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 -- cgit v1.2.1