From 9a660b3b49de0a06458d8ced46d28bf30b94dcd3 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 29 Sep 2022 16:06:57 +0100 Subject: [PATCH] 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. --- plugins/eddn.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/eddn.py b/plugins/eddn.py index 9f0d7e61..9a0a3324 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -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]] = []