From 10ca50bf5a2d7d3c42c601c81aff21a643b02436 Mon Sep 17 00:00:00 2001
From: A_D <aunderscored@gmail.com>
Date: Sat, 24 Oct 2020 09:33:16 +0200
Subject: [PATCH] Moved edsm killswitch check

It was causing exit hangs when edsm was disabled
---
 plugins/edsm.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/plugins/edsm.py b/plugins/edsm.py
index d6e0f706..67ae4db8 100644
--- a/plugins/edsm.py
+++ b/plugins/edsm.py
@@ -509,12 +509,11 @@ def worker() -> None:
             logger.debug('Empty queue message, setting closing = True')
             closing = True  # Try to send any unsent events before we close
 
-        if killswitch.is_disabled("plugins.edsm.worker"):
-            logger.warning('EDSM worker has been disabled via kill switch. Not uploading data.')
-            continue
-
         retrying = 0
         while retrying < 3:
+            if killswitch.is_disabled("plugins.edsm.worker"):
+                logger.warning('EDSM worker has been disabled via kill switch. Not uploading data.')
+                break
             try:
                 if TYPE_CHECKING:
                     # Tell the type checker that these two are bound.