mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Added more debug information (queried DB commands)
This commit is contained in:
parent
964687aade
commit
a46ae8f13e
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -6,4 +6,5 @@ logs/
|
|||
*.code-workspace
|
||||
*.bat
|
||||
source-file-list.txt
|
||||
*.po~
|
||||
*.po~
|
||||
locale/
|
|
@ -14,6 +14,7 @@ from src.exceptions import NoDomain
|
|||
from src.config import settings
|
||||
from src.domain import Domain
|
||||
from src.irc_feed import AioIRCCat
|
||||
from src.queue_handler import dbmanager
|
||||
from io import StringIO
|
||||
from contextlib import redirect_stdout
|
||||
from src.wiki import Wiki
|
||||
|
@ -94,6 +95,7 @@ class DomainManager:
|
|||
"tasks": {},
|
||||
"domains": {},
|
||||
"queued_messages": [],
|
||||
"awaiting_DB_queries": dbmanager.updated,
|
||||
"total_discord_messages_sent": sum([x.total_discord_messages_sent for x in self.domains.values()])
|
||||
}
|
||||
for task in asyncio.all_tasks():
|
||||
|
|
17
src/wiki.py
17
src/wiki.py
|
@ -45,7 +45,6 @@ class Wiki:
|
|||
self.statistics: Statistics = Statistics(rc_id, discussion_id)
|
||||
self.mw_messages: Optional[MWMessages] = None
|
||||
self.tags: dict[str, Optional[str]] = {} # Tag can be None if hidden
|
||||
self.first_fetch_done: bool = False
|
||||
self.domain: Optional[Domain] = None
|
||||
self.rc_targets: Optional[defaultdict[Settings, list[str]]] = None
|
||||
self.discussion_targets: Optional[defaultdict[Settings, list[str]]] = None
|
||||
|
@ -62,20 +61,24 @@ class Wiki:
|
|||
|
||||
def __repr__(self):
|
||||
return (
|
||||
f"<statistics={self.statistics} tags={self.tags} first_fetch_done={self.first_fetch_done}, rc_targets={self.rc_targets}, discussion_targets={self.discussion_targets},"
|
||||
f"<statistics={self.statistics} tags={self.tags} rc_targets={self.rc_targets}, discussion_targets={self.discussion_targets},"
|
||||
f"recache_requested={self.recache_requested}>")
|
||||
|
||||
def json(self) -> dict:
|
||||
dict_obj = {
|
||||
"wiki_url": self.script_url,
|
||||
"tags": self.tags,
|
||||
"first_fetch_done": self.first_fetch_done,
|
||||
"rc_targets": {str(x): [webhook_url.split("/")[0] for webhook_url in y] for x, y in self.rc_targets.items()} if self.rc_targets else None,
|
||||
"discussion_targets": {str(x): [webhook_url.split("/")[0] for webhook_url in y] for x, y in self.discussion_targets.items()} if self.discussion_targets else None,
|
||||
"namespaces": self.namespaces,
|
||||
"logs": [x.json() for x in self.statistics.logs],
|
||||
"last_checked_rc": self.statistics.last_checked_rc,
|
||||
"last_action": self.statistics.last_action
|
||||
"last_action": self.statistics.last_action,
|
||||
"last_checked_discussion": self.statistics.last_checked_discussion,
|
||||
"last_post": self.statistics.last_post,
|
||||
"logs": [x.json() for x in self.statistics.logs],
|
||||
"namespaces": self.namespaces,
|
||||
"tags": self.tags,
|
||||
"recache_requested": self.recache_requested,
|
||||
"cached_discord_messages": len(self.message_history),
|
||||
"discord_message_history": [message.json() for message in self.message_history[-10:]]
|
||||
}
|
||||
if self.domain.name == "fandom.com":
|
||||
dict_obj.update(last_checked_discussion=self.statistics.last_checked_discussion, last_post=self.statistics.last_post)
|
||||
|
|
Loading…
Reference in a new issue