Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
msg_info = send_queue.get()
msg = {}
msg['user'] = msg_info['user']
msg['mode'] = msg_info['mode']
context = json_loads(msg_info['context'])
msg['subject'] = msg_info['subject'] % context
msg['body'] = msg_info['body'] % context
try:
send_message(msg)
except:
logger.exception('Failed to send message %s', msg)
mark_message_as_unsent(msg_info)
metrics.stats['message_fail_cnt'] += 1
else:
mark_message_as_sent(msg_info)
metrics.stats['message_sent_cnt'] += 1
def blackhole(msg):
logger.info('Sent message %s' % msg)
metrics.stats['message_blackhole_cnt'] += 1