mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-24 01:04:09 +00:00
I don't really know what I'm doing
This commit is contained in:
parent
dd449a9fc5
commit
a24b2cee39
|
@ -2,6 +2,7 @@ from __future__ import annotations
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import TYPE_CHECKING, Optional
|
from typing import TYPE_CHECKING, Optional
|
||||||
from functools import cache
|
from functools import cache
|
||||||
|
@ -119,8 +120,9 @@ class Domain:
|
||||||
if command_line_args.debug:
|
if command_line_args.debug:
|
||||||
logger.exception("IRC scheduler task for domain {} failed!".format(self.name))
|
logger.exception("IRC scheduler task for domain {} failed!".format(self.name))
|
||||||
else:
|
else:
|
||||||
await self.send_exception_to_monitoring(e)
|
|
||||||
self.failures += 1
|
self.failures += 1
|
||||||
|
traceback.print_exc()
|
||||||
|
await self.send_exception_to_monitoring(e)
|
||||||
if self.failures > 2:
|
if self.failures > 2:
|
||||||
raise asyncio.exceptions.CancelledError
|
raise asyncio.exceptions.CancelledError
|
||||||
|
|
||||||
|
@ -163,7 +165,7 @@ class Domain:
|
||||||
async def send_exception_to_monitoring(self, ex: Exception):
|
async def send_exception_to_monitoring(self, ex: Exception):
|
||||||
discord_message = DiscordMessage("embed", "generic", [""])
|
discord_message = DiscordMessage("embed", "generic", [""])
|
||||||
discord_message["title"] = "Domain scheduler exception for {} (recovered)".format(self.name)
|
discord_message["title"] = "Domain scheduler exception for {} (recovered)".format(self.name)
|
||||||
discord_message["content"] = str(ex)[0:1995]
|
discord_message["content"] = traceback.format_exc(ex)[0:1995]
|
||||||
discord_message.add_field("Failure count", str(self.failures))
|
discord_message.add_field("Failure count", str(self.failures))
|
||||||
discord_message.finish_embed_message()
|
discord_message.finish_embed_message()
|
||||||
header = settings["header"]
|
header = settings["header"]
|
||||||
|
|
|
@ -47,7 +47,7 @@ class DomainManager:
|
||||||
logger.info(self.domains)
|
logger.info(self.domains)
|
||||||
for name, domain in self.domains.items():
|
for name, domain in self.domains.items():
|
||||||
logger.info("{name} - Status: {status}, exception: {exception}".format(name=name, status=domain.task.done(),
|
logger.info("{name} - Status: {status}, exception: {exception}".format(name=name, status=domain.task.done(),
|
||||||
exception=domain.task.get_stack()))
|
exception=domain.task.print_stack()))
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unknown pub/sub command! Payload: {}".format(payload))
|
raise ValueError("Unknown pub/sub command! Payload: {}".format(payload))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue