1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

eddn/fsssignaldiscovered: Catch where no signals pass checks

Else we attempt to send an empty `signals` array, which the schema prohibits.
This commit is contained in:
Athanasius 2022-06-19 11:47:24 +01:00
parent f5f8607fae
commit e38ce639f0
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D

View File

@ -1396,14 +1396,14 @@ class EDDN:
f"{s['SystemAddress']} != {aug_systemaddress}")
continue
# Remove any _Localised keys (would only be in a USS signal)
s = filter_localised(s)
# Drop Mission USS signals.
if "USSType" in s and s["USSType"] == "$USS_Type_MissionTarget;":
logger.trace_if("plugin.eddn.fsssignaldiscovered", "USSType is $USS_Type_MissionTarget;, dropping")
continue
# Remove any _Localised keys (would only be in a USS signal)
s = filter_localised(s)
# Remove any key/values that shouldn't be there per signal
s.pop('event', None)
s.pop('horizons', None)
@ -1413,6 +1413,12 @@ class EDDN:
msg['message']['signals'].append(s)
if not msg['message']['signals']:
# No signals passed checks, so drop them all and return
logger.debug('No signals after checks, so sending no message')
self.fss_signals = []
return None
# `horizons` and `odyssey` augmentations
msg['message']['horizons'] = entry['horizons']
msg['message']['odyssey'] = entry['odyssey']