From 25ed649b7ae973a990c38ff6438eb16ff7660d1e Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 6 Dec 2022 15:34:12 +0000 Subject: [PATCH] monitor/NavRoute: Load NavRoute after catching_up ends. This is to allow restart of EDMarketConnector whilst the game is running to have `state['NavRoute']` hold data when the synthetic `StartUp` event is passed to plugins. NB: Probably need to note this in PLUGINS.md --- monitor.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/monitor.py b/monitor.py index d8c5707e..4a7a2369 100644 --- a/monitor.py +++ b/monitor.py @@ -397,6 +397,12 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below except Exception as ex: logger.debug(f'Invalid journal entry:\n{line!r}\n', exc_info=ex) + # One-shot attempt to read in latest NavRoute, if present + navroute_data = self._parse_navroute_file() + if navroute_data is not None: + # If it's NavRouteClear contents, just keep those anyway. + self.state['NavRoute'] = navroute_data + self.catching_up = False log_pos = loghandle.tell()