Simplify _WrappedConsumer.moar.

pull/530/head
Nathaniel Manista 10 years ago
parent 96e352c008
commit 6edb45189e
  1. 13
      src/python/src/_framework/base/packets/_ingestion.py

@ -183,7 +183,7 @@ class _WrappedConsumer(object):
payload: A customer-significant payload object. May be None only if
complete is True.
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:
True if the wrapped consumer made progress or False if the wrapped
@ -191,13 +191,12 @@ class _WrappedConsumer(object):
progress.
"""
try:
if payload:
if complete:
self._consumer.consume_and_terminate(payload)
else:
self._consumer.consume(payload)
else:
if payload is None:
self._consumer.terminate()
elif complete:
self._consumer.consume_and_terminate(payload)
else:
self._consumer.consume(payload)
return True
except abandonment.Abandoned:
return False

Loading…
Cancel
Save