in amazon_polly_async_batch/setprocessor.py [0:0]
def post_item(queue, item, count):
"""
Posts an item as a message to an SQS queue
:param queue: the SQS queue
:param item: the item to post
:return: success of operation
"""
item_name = item.get('output-file', '[unidentified]')
# Neural voices have a much lower tps service quota, so put them all in the same group. This effectively
# single-threads their processing. Standard voices can fan out more without trouble.
item_group = 'neural' if item['engine'] == 'neural' else 'standard-{}'.format(count % 5)
try:
logger.debug('Posting item {} to queue group {}'.format(item_name, item_group))
queue.send_message(MessageBody=json.dumps(item),
MessageGroupId=item_group,
MessageDeduplicationId=item_name)
return True
except Exception as e:
logger.error('Failed to post item for {} because {}'.format(item_name, str(e)))
return False