From 1895a365aef67fa52fdb5753a2776815cb32a2c8 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sun, 20 Jul 2025 05:41:50 -0700 Subject: [PATCH] fix retry and failure correcting multiple issues with some bad code https://github.com/SpudGunMan/meshing-around/issues/137 https://github.com/SpudGunMan/meshing-around/issues/156 --- modules/settings.py | 3 +-- modules/system.py | 9 +++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/settings.py b/modules/settings.py index ea23be9..c3e2cb9 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -21,8 +21,7 @@ ping_enabled = True # ping feature to respond to pings, ack's etc. sitrep_enabled = True # sitrep feature to respond to sitreps lastHamLibAlert = 0 # last alert from hamlib lastFileAlert = 0 # last alert from file monitor -max_retry_count1 = 4 # max retry count for interface 1 -max_retry_count2 = 4 # max retry count for interface 2 +max_retry_count1 = max_retry_count2 = max_retry_count3 = max_retry_count4 = max_retry_count5 = max_retry_count6 = max_retry_count7 = max_retry_count8 = max_retry_count9 = 4 # default retry count for interfaces retry_int1 = False retry_int2 = False wiki_return_limit = 3 # limit the number of sentences returned off the first paragraph first hit diff --git a/modules/system.py b/modules/system.py index 8f6e446..12a6dbd 100644 --- a/modules/system.py +++ b/modules/system.py @@ -823,8 +823,13 @@ def onDisconnect(interface): logger.critical(f"System: Lost Connection to Device {interface}") for i in range(1, 10): if globals().get(f'interface{i}_enabled'): - globals()[f'retry_int{i}'] = True - break + if globals().get(f'max_retry_count{i}') > 0: + retry_flag = globals().get(f'retry_int{i}') + if not retry_flag: + globals()[f'retry_int{i}'] = True + else: + logger.critical(f"System: Interface{i} {globals()[f'interface{i}']} failed to reconnect after multiple attempts. Exiting") + exit_handler() def exit_handler(): # Close the interface and save the BBS messages