catch all exceptions when trying to rteply
This commit is contained in:
parent
ab13a252f7
commit
d92506d84f
|
@ -191,8 +191,8 @@ async def process_chat(
|
||||||
response = await task
|
response = await task
|
||||||
if response is not None:
|
if response is not None:
|
||||||
break
|
break
|
||||||
except stopit.utils.TimeoutException:
|
except Exception as e: # (stopit.utils.TimeoutException, openai.error.APIConnectionError)
|
||||||
logger.warning(f'Timed out replying to event {event.event_id}, retrying...')
|
logger.warning(f'Got exception when trying to reply to event {event.event_id}, retrying: {e}')
|
||||||
await client.room_typing(room.room_id, typing_state=True, timeout=15000)
|
await client.room_typing(room.room_id, typing_state=True, timeout=15000)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
continue
|
continue
|
||||||
|
@ -225,6 +225,7 @@ async def process_chat(
|
||||||
store.add_event_id(event.event_id)
|
store.add_event_id(event.event_id)
|
||||||
if not isinstance(resp, RoomSendResponse):
|
if not isinstance(resp, RoomSendResponse):
|
||||||
logger.critical(f'Failed to respond to event {event.event_id} in room {room.room_id}:\n{vars(resp)}')
|
logger.critical(f'Failed to respond to event {event.event_id} in room {room.room_id}:\n{vars(resp)}')
|
||||||
|
await react_to_event(client, room.room_id, event.event_id, '❌')
|
||||||
else:
|
else:
|
||||||
store.add_event_id(resp.event_id)
|
store.add_event_id(resp.event_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue