diff options
author | Mahendra M <mahendra.m@gmail.com> | 2013-06-27 16:26:01 +0530 |
---|---|---|
committer | Mahendra M <mahendra.m@gmail.com> | 2013-06-27 16:26:01 +0530 |
commit | d6d7299b7dc00f852014e34df060de9268eddfae (patch) | |
tree | b8430a462a5deb4f0a56d256659ddcda38d104f4 | |
parent | 2ce321771825c83d51c52801d6736052289faf83 (diff) | |
download | kafka-python-d6d7299b7dc00f852014e34df060de9268eddfae.tar.gz |
Fix a bug in seek.
This was hidden because of another bug in offset management
-rw-r--r-- | kafka/consumer.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kafka/consumer.py b/kafka/consumer.py index b87ed1c..67e1b10 100644 --- a/kafka/consumer.py +++ b/kafka/consumer.py @@ -259,6 +259,12 @@ class SimpleConsumer(Consumer): reqs.append(OffsetRequest(self.topic, partition, -2, 1)) elif whence == 2: reqs.append(OffsetRequest(self.topic, partition, -1, 1)) + + # The API returns back the next available offset + # For eg: if the current offset is 18, the API will return + # back 19. So, if we have to seek 5 points before, we will + # end up going back to 14, instead of 13. Adjust this + deltas[partition] -= 1 else: pass |