Skip to content
Snippets Groups Projects
Commit 6edb4518 authored by Nathaniel Manista's avatar Nathaniel Manista
Browse files

Simplify _WrappedConsumer.moar.

parent 96e352c0
No related branches found
No related tags found
No related merge requests found
...@@ -183,7 +183,7 @@ class _WrappedConsumer(object): ...@@ -183,7 +183,7 @@ class _WrappedConsumer(object):
payload: A customer-significant payload object. May be None only if payload: A customer-significant payload object. May be None only if
complete is True. complete is True.
complete: Whether or not the end of the payload sequence has been reached. complete: Whether or not the end of the payload sequence has been reached.
May be False only if payload is not None. Must be True if payload is None.
Returns: Returns:
True if the wrapped consumer made progress or False if the wrapped True if the wrapped consumer made progress or False if the wrapped
...@@ -191,13 +191,12 @@ class _WrappedConsumer(object): ...@@ -191,13 +191,12 @@ class _WrappedConsumer(object):
progress. progress.
""" """
try: try:
if payload: if payload is None:
if complete:
self._consumer.consume_and_terminate(payload)
else:
self._consumer.consume(payload)
else:
self._consumer.terminate() self._consumer.terminate()
elif complete:
self._consumer.consume_and_terminate(payload)
else:
self._consumer.consume(payload)
return True return True
except abandonment.Abandoned: except abandonment.Abandoned:
return False return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment