actor: cleanly catch exceptions while delivering messages

This commit is contained in:
kaniini 2018-11-18 22:05:41 +00:00
parent ccd0e12b0a
commit e0d633b861

View file

@ -93,12 +93,15 @@ async def push_message_to_actor(actor, message, our_key_id):
logging.debug('%r >> %r', inbox, message) logging.debug('%r >> %r', inbox, message)
try:
async with aiohttp.ClientSession(trace_configs=[http_debug()]) as session: async with aiohttp.ClientSession(trace_configs=[http_debug()]) as session:
async with session.post(inbox, data=data, headers=headers) as resp: async with session.post(inbox, data=data, headers=headers) as resp:
if resp.status == 202: if resp.status == 202:
return return
resp_payload = await resp.text() resp_payload = await resp.text()
logging.debug('%r >> resp %r', inbox, resp_payload) logging.debug('%r >> resp %r', inbox, resp_payload)
except Exception as e:
logging.info('Caught %r while pushing to %r.', e, inbox)
async def follow_remote_actor(actor_uri): async def follow_remote_actor(actor_uri):