Dont use soon-to-be-reserved keyword await as function name (FutureProduceResult)

This commit is contained in:
Dana Powers
2016-05-22 16:15:56 -07:00
parent 96530f6a9c
commit c7b7be110f
2 changed files with 3 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ class FutureProduceResult(Future):
self._latch.set() self._latch.set()
return ret return ret
def await(self, timeout=None): def wait(self, timeout=None):
# wait() on python2.6 returns None instead of the flag value # wait() on python2.6 returns None instead of the flag value
return self._latch.wait(timeout) or self._latch.is_set() return self._latch.wait(timeout) or self._latch.is_set()
@@ -46,7 +46,7 @@ class FutureRecordMetadata(Future):
self.relative_offset)) self.relative_offset))
def get(self, timeout=None): def get(self, timeout=None):
if not self.is_done and not self._produce_future.await(timeout): if not self.is_done and not self._produce_future.wait(timeout):
raise Errors.KafkaTimeoutError( raise Errors.KafkaTimeoutError(
"Timeout after waiting for %s secs." % timeout) "Timeout after waiting for %s secs." % timeout)
assert self.is_done assert self.is_done

View File

@@ -470,7 +470,7 @@ class RecordAccumulator(object):
for batch in self._incomplete.all(): for batch in self._incomplete.all():
log.debug('Waiting on produce to %s', log.debug('Waiting on produce to %s',
batch.produce_future.topic_partition) batch.produce_future.topic_partition)
assert batch.produce_future.await(timeout=timeout), 'Timeout waiting for future' assert batch.produce_future.wait(timeout=timeout), 'Timeout waiting for future'
assert batch.produce_future.is_done, 'Future not done?' assert batch.produce_future.is_done, 'Future not done?'
if batch.produce_future.failed(): if batch.produce_future.failed():
log.warning(batch.produce_future.exception) log.warning(batch.produce_future.exception)