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
This commit is contained in:
SpudGunMan
2025-07-20 05:41:50 -07:00
parent cc58a38165
commit 1895a365ae
2 changed files with 8 additions and 4 deletions

View File

@@ -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

View File

@@ -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