mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-16 09:10:35 +03:00
EDDN: Allow sending of empty market data for updating FCs.
This commit is contained in:
parent
ae82f27925
commit
9564d8ab4f
@ -147,6 +147,13 @@ Headers\t{r.headers}
|
||||
Content:\n{r.text}
|
||||
Msg:\n{msg}''')
|
||||
|
||||
# Check if EDDN is still objecting to an empty commodities list
|
||||
if r.status_code == 400 \
|
||||
and msg['$schemaRef'] == 'https://eddn.edcd.io/schemas/commodity/3' \
|
||||
and this.commodities == [] \
|
||||
and r.text == "FAIL: [<ValidationError: '[] is too short'>]":
|
||||
logger.trace("EDDN is still objecting to empty commodities data")
|
||||
|
||||
r.raise_for_status()
|
||||
|
||||
def sendreplay(self) -> None:
|
||||
@ -238,7 +245,13 @@ Msg:\n{msg}''')
|
||||
|
||||
commodities.sort(key=lambda c: c['name'])
|
||||
|
||||
if commodities and this.commodities != commodities: # Don't send empty commodities list - schema won't allow it
|
||||
# This used to have a check `commodities and ` at the start so as to
|
||||
# not send an empty commodities list, as the EDDN Schema doesn't allow
|
||||
# it (as of 2020-09-28).
|
||||
# BUT, Fleet Carriers can go from having buy/sell orders to having
|
||||
# none and that really does need to be recorded over EDDN so that, e.g.
|
||||
# EDDB can update in a timely manner.
|
||||
if this.commodities != commodities:
|
||||
message: OrderedDictT[str, Any] = OrderedDict([
|
||||
('timestamp', data['timestamp']),
|
||||
('systemName', data['lastSystem']['name']),
|
||||
|
Loading…
x
Reference in New Issue
Block a user