Reset consumer fields to original values rather than defaults in FetchContext
This commit is contained in:
@@ -40,6 +40,8 @@ class FetchContext(object):
|
|||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
"""Set fetch values based on blocking status"""
|
"""Set fetch values based on blocking status"""
|
||||||
|
self.orig_fetch_max_wait_time = self.consumer.fetch_max_wait_time
|
||||||
|
self.orig_fetch_min_bytes = self.consumer.fetch_min_bytes
|
||||||
if self.block:
|
if self.block:
|
||||||
self.consumer.fetch_max_wait_time = self.timeout
|
self.consumer.fetch_max_wait_time = self.timeout
|
||||||
self.consumer.fetch_min_bytes = 1
|
self.consumer.fetch_min_bytes = 1
|
||||||
@@ -47,9 +49,9 @@ class FetchContext(object):
|
|||||||
self.consumer.fetch_min_bytes = 0
|
self.consumer.fetch_min_bytes = 0
|
||||||
|
|
||||||
def __exit__(self, type, value, traceback):
|
def __exit__(self, type, value, traceback):
|
||||||
"""Reset values to default"""
|
"""Reset values"""
|
||||||
self.consumer.fetch_max_wait_time = FETCH_MAX_WAIT_TIME
|
self.consumer.fetch_max_wait_time = self.orig_fetch_max_wait_time
|
||||||
self.consumer.fetch_min_bytes = FETCH_MIN_BYTES
|
self.consumer.fetch_min_bytes = self.orig_fetch_min_bytes
|
||||||
|
|
||||||
|
|
||||||
class Consumer(object):
|
class Consumer(object):
|
||||||
|
|||||||
Reference in New Issue
Block a user