mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-22 00:44:10 +00:00
Change used exception type for one of the errors
This commit is contained in:
parent
c8080e60b3
commit
0b3a868640
|
@ -11,8 +11,7 @@ import sys
|
|||
|
||||
import aiohttp
|
||||
|
||||
from src.exceptions import WikiOnTimeout
|
||||
from src.exceptions import WikiNotFoundError
|
||||
from src.exceptions import WikiNotFoundError, WikiOnTimeout, NoAvailableWiki
|
||||
from src.misc import LimitedList
|
||||
from src.discord.message import DiscordMessage
|
||||
from src.config import settings
|
||||
|
@ -61,7 +60,8 @@ class Domain:
|
|||
"msgdelay": {"min": min(self.message_timings or [0]), "avg": int(sum(self.message_timings)/(len(self.message_timings) or 1)),
|
||||
"max": max(self.message_timings or [0])},
|
||||
"discord_messages": self.total_discord_messages_sent,
|
||||
"last_failure_report": self.last_failure_report
|
||||
"last_failure_report": self.last_failure_report,
|
||||
"wikis_on_timeout": [name for name, value in self.wikis.items() if value.is_on_timeout()]
|
||||
}
|
||||
return dict_obj
|
||||
def __repr__(self):
|
||||
|
@ -135,7 +135,7 @@ class Domain:
|
|||
:raises StopIteration: When None has been passed as wiki, means there are no more wikis in the queue besides timeouted ones
|
||||
"""
|
||||
if wiki is None:
|
||||
raise StopIteration
|
||||
raise NoAvailableWiki
|
||||
try:
|
||||
await wiki.scan()
|
||||
except WikiNotFoundError as e:
|
||||
|
@ -233,7 +233,7 @@ class Domain:
|
|||
while True:
|
||||
await asyncio.sleep(self.calculate_sleep_time(len(self))) # To make sure that we don't spam domains with one wiki every second we calculate a sane timeout for domains with few wikis
|
||||
await self.run_wiki_scan(self.find_first_not_on_timeout(), "regular check")
|
||||
except StopIteration:
|
||||
except NoAvailableWiki:
|
||||
logger.debug(f"Domain {self.name} received StopIteration, returning from regular_scheduler...")
|
||||
return
|
||||
except Exception as e:
|
||||
|
|
|
@ -26,6 +26,9 @@ class OtherWikiError(Exception):
|
|||
class QueueEmpty(Exception):
|
||||
pass
|
||||
|
||||
class NoAvailableWiki(Exception):
|
||||
pass
|
||||
|
||||
class ListFull(Exception):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in a new issue