Fix last remaining test by making autocommit more intuitive

This commit is contained in:
Mark Roberts
2014-04-24 00:25:35 -07:00
parent 583d3ae22b
commit 0e50f33ec6
2 changed files with 3 additions and 3 deletions

View File

@@ -164,7 +164,7 @@ class Consumer(object):
if not self.auto_commit or self.auto_commit_every_n is None:
return
if self.count_since_commit > self.auto_commit_every_n:
if self.count_since_commit >= self.auto_commit_every_n:
self.commit()
def stop(self):

View File

@@ -228,13 +228,13 @@ class TestConsumerIntegration(KafkaIntegrationTestCase):
output_msgs1 = [ consumer1.get_message().message.value for _ in xrange(195) ]
self.assert_message_count(output_msgs1, 195)
# The offset should be at 180
# The total offset across both partitions should be at 180
consumer2 = self.consumer(
auto_commit_every_t = 600,
auto_commit_every_n = 20,
)
# 180-200
# 181-200
self.assert_message_count([ message for message in consumer2 ], 20)
consumer1.stop()