From 26115a14f0a613309d628ec76980c04ace3b8441 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 5 Aug 2021 15:01:33 +0100 Subject: [PATCH] plugins/edsm: should_send() == True for any Shutdown event We MUST attempt flushing pending events in case of commander change. --- plugins/edsm.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/edsm.py b/plugins/edsm.py index 2561dc3b..b1b388eb 100644 --- a/plugins/edsm.py +++ b/plugins/edsm.py @@ -760,6 +760,13 @@ def should_send(entries: List[Mapping[str, Any]]) -> bool: # noqa: CCR001 :param entries: The entries to check :return: bool indicating whether or not to send said entries """ + # We MUST flush pending on logout, in case new login is a different Commander + if any(e for e in entries if e['event'] == 'Shutdown'): + if 'edsm-cmdr-events' in trace_on: + logger.trace('True because Shutdown') + + return True + # batch up burst of Scan events after NavBeaconScan if this.navbeaconscan: if entries and entries[-1]['event'] == 'Scan':