mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-22 00:44:10 +00:00
Compare commits
2 commits
0b3a868640
...
969b7c14ba
Author | SHA1 | Date | |
---|---|---|---|
|
969b7c14ba | ||
|
f33be9a127 |
|
@ -174,6 +174,11 @@ class DomainManager:
|
||||||
req_id, json_part)
|
req_id, json_part)
|
||||||
await connection.execute("select pg_notify('debugresponse', 'SITE END ' || $1);",
|
await connection.execute("select pg_notify('debugresponse', 'SITE END ' || $1);",
|
||||||
req_id)
|
req_id)
|
||||||
|
else:
|
||||||
|
await connection.execute("select pg_notify('debugresponse', 'SITE CHUNK ' || $1 || ' ' || $2);",
|
||||||
|
req_id, json.dumps({"error": "Wiki has not been found in running cache. Please make sure you've given appropriate script URL.", "url": "https://frisk.space/imgs/cat.png"}))
|
||||||
|
await connection.execute("select pg_notify('debugresponse', 'SITE END ' || $1);",
|
||||||
|
req_id)
|
||||||
else:
|
else:
|
||||||
logger.error("Unknown pub/sub command! Payload: {}".format(payload))
|
logger.error("Unknown pub/sub command! Payload: {}".format(payload))
|
||||||
|
|
||||||
|
|
|
@ -322,6 +322,7 @@ class Wiki:
|
||||||
# any([True for k in request_data.keys() if k in ("error", "errors")])
|
# any([True for k in request_data.keys() if k in ("error", "errors")])
|
||||||
errors: list = request_data.get("errors", {}) # Is it ugly? I don't know tbh
|
errors: list = request_data.get("errors", {}) # Is it ugly? I don't know tbh
|
||||||
if errors:
|
if errors:
|
||||||
|
logger.error("MediaWiki error on request: {}".format(url))
|
||||||
raise MediaWikiError(str(errors))
|
raise MediaWikiError(str(errors))
|
||||||
warnings: list = request_data.get("warnings", {})
|
warnings: list = request_data.get("warnings", {})
|
||||||
if warnings:
|
if warnings:
|
||||||
|
@ -398,9 +399,6 @@ class Wiki:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.warning("ValueError when extracting JSON data on {url}".format(url=request.url))
|
logger.warning("ValueError when extracting JSON data on {url}".format(url=request.url))
|
||||||
raise ServerError
|
raise ServerError
|
||||||
except MediaWikiError:
|
|
||||||
logger.exception("MediaWiki error on request: {}".format(request.url))
|
|
||||||
raise
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.exception("KeyError while iterating over json_path, full response: {}".format(request.json()))
|
logger.exception("KeyError while iterating over json_path, full response: {}".format(request.json()))
|
||||||
raise
|
raise
|
||||||
|
@ -485,7 +483,7 @@ class Wiki:
|
||||||
try:
|
try:
|
||||||
request = await self.fetch_wiki(amount=amount)
|
request = await self.fetch_wiki(amount=amount)
|
||||||
self.client.last_request = request
|
self.client.last_request = request
|
||||||
except (aiohttp.ServerTimeoutError, asyncio.TimeoutError, WikiServerError, ServerError) as e:
|
except (aiohttp.ServerTimeoutError, asyncio.TimeoutError, WikiServerError, ServerError, MediaWikiError) as e:
|
||||||
self.statistics.update(Log(type=LogType.CONNECTION_ERROR, title=str(str(e.exception) if hasattr(e, "exception") else repr(e))))
|
self.statistics.update(Log(type=LogType.CONNECTION_ERROR, title=str(str(e.exception) if hasattr(e, "exception") else repr(e))))
|
||||||
amount_of_failures = len(self.statistics.last_connection_failures()[0])
|
amount_of_failures = len(self.statistics.last_connection_failures()[0])
|
||||||
if amount_of_failures < 2:
|
if amount_of_failures < 2:
|
||||||
|
|
Loading…
Reference in a new issue