From 61843ee71c1661095da80ab5f44a236d488c8981 Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Wed, 19 Jun 2024 21:28:31 +0200 Subject: [PATCH] Refactor Sunnylink registration condition The condition for Sunnylink registration has been simplified and refactored within the main loop. Previously, the "is_registered" variable was being set outside the registration loop. Now, the checking process of the dongle ID in regard to the registration status is directly integrated into the while condition. This makes the code more concise and the process flow clearer. --- system/athena/sunnylinkd.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/system/athena/sunnylinkd.py b/system/athena/sunnylinkd.py index 2f19983198..529d1b2059 100755 --- a/system/athena/sunnylinkd.py +++ b/system/athena/sunnylinkd.py @@ -190,8 +190,7 @@ def main(exit_event: threading.Event = None): except Exception: cloudlog.exception("failed to set core affinity") - is_registered = params.get("SunnylinkDongleId", encoding='utf-8') not in (None, UNREGISTERED_SUNNYLINK_DONGLE_ID) - while params.get_bool("SunnylinkEnabled") and not is_registered: + while params.get_bool("SunnylinkEnabled") and not params.get("SunnylinkDongleId", encoding='utf-8') not in (None, UNREGISTERED_SUNNYLINK_DONGLE_ID): cloudlog.info("Waiting for sunnylink registration to complete") time.sleep(10)