Skip to content

Commit

Permalink
monitor: complain to matrix when quitting
Browse files Browse the repository at this point in the history
  • Loading branch information
cgevans committed Nov 4, 2024
1 parent 2c04f74 commit 31f7e0e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/qslib/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,18 @@ async def reliable_monitor(
successive_failures += 1
else:
log.critical(f"giving up, error {e}", exc_info=True)
if self.matrix_client and self.matrix_config:
try:
await self.matrix_client.room_send(
room_id=self.matrix_config.room,
message_type="m.room.message",
content={
"msgtype": "m.text",
"body": f"Unrecoverable error in QS monitoring (tried 3 times), giving up: {e}, {e.__traceback__}"
}
)
except Exception as matrix_e:
log.error(f"Failed to send Matrix message: {matrix_e}")
restart = False
log.debug("awaiting retry")
await asyncio.sleep(30)

0 comments on commit 31f7e0e

Please sign in to comment.