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

EDDN: New class as EDDNSender now, and version the queue database file

* It makes more sense for this new class to be concerned with all the 'send it'
  functionality, not just 'replay', so rename it.
* Athough we're trying to get the schema right *first* time, let's plan ahead
  and version the filename in case of needing to migrations in the future.
This commit is contained in:
Athanasius 2022-09-29 16:06:57 +01:00 committed by Athanasius
parent 424d5f023c
commit 9a660b3b49
No known key found for this signature in database
GPG Key ID: 772697E181BB2767

View File

@ -125,10 +125,10 @@ HORIZONS_SKU = 'ELITE_HORIZONS_V_PLANETARY_LANDINGS'
# one.
class EDDNReplay:
class EDDNSender:
"""Store and retry sending of EDDN messages."""
SQLITE_DB_FILENAME = 'eddn_replay.db'
SQLITE_DB_FILENAME = 'eddn_queue-v1.db'
def __init__(self) -> None:
"""
@ -188,6 +188,8 @@ class EDDNReplay:
of `header`, `$schemaRef` and `message`. Code handling this not being
the case is only for loading the legacy `replay.json` file messages.
TODO: Return the unique row id of the added message.
:param cmdr: Name of the Commander that created this message.
:param msg: The full, transmission-ready, EDDN message.
"""
@ -267,11 +269,7 @@ class EDDN:
self.session = requests.Session()
self.session.headers['User-Agent'] = user_agent
#######################################################################
# EDDN delayed sending/retry
#######################################################################
self.replay = EDDNReplay()
#######################################################################
self.sender = EDDNSender()
self.fss_signals: List[Mapping[str, Any]] = []