1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 08:40:34 +03:00

EDDN: Drop messages if EDDN says it doesn't know the schema

Currently Live EDDN doesn't yet have the new schemas such as navroute,
so will complain.  Rather than leaving such messages in our EDDN replay
queue and getting an error every time that is run, detect this error
case and drop the messages.
This commit is contained in:
Athanasius 2021-10-17 14:24:23 +01:00
parent fc34d023b6
commit 5ae953bf45
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D

View File

@ -106,6 +106,11 @@ class EDDN:
TIMEOUT = 10 # requests timeout
MODULE_RE = re.compile(r'^Hpt_|^Int_|Armour_', re.IGNORECASE)
CANONICALISE_RE = re.compile(r'\$(.+)_name;')
UNKNOWN_SCHEMA_RE = re.compile(
r"^FAIL: \[JsonValidationException\('Schema "
r"https://eddn.edcd.io/schemas/(?P<schema_name>.+)/(?P<schema_version>[0-9]+) is unknown, "
r"unable to validate.',\)\]$"
)
def __init__(self, parent: tk.Tk):
self.parent: tk.Tk = parent
@ -210,6 +215,11 @@ class EDDN:
logger.trace_if('plugin.eddn', "EDDN is still objecting to empty commodities data")
return # We want to silence warnings otherwise
if unknown_schema := self.UNKNOWN_SCHEMA_RE.match(r.text):
logger.warning(f"EDDN doesn't (yet?) know about schema: {unknown_schema['schema_name']}"
f"/{unknown_schema['schema_version']}")
return # Pretend it went OK so this message isn't retried
logger.debug(
f'''Status from POST wasn't OK:
Status\t{r.status_code}