From 7834fff54125c834773011ce3cfa254036fc3687 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Thu, 29 May 2025 16:52:13 +0800 Subject: [PATCH] Update dashboard.py Potential fix for #762 --- src/dashboard.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/dashboard.py b/src/dashboard.py index 9ce1eb6..98b55f2 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -3115,16 +3115,19 @@ def peerInformationBackgroundThread(): time.sleep(10) while True: with app.app_context(): - for c in WireguardConfigurations.values(): - if c.getStatus(): - try: - c.getPeersTransfer() - c.getPeersLatestHandshake() - c.getPeersEndpoint() - c.getPeersList() - c.getRestrictedPeersList() - except Exception as e: - print(f"[WGDashboard] Background Thread #1 Error: {str(e)}", flush=True) + try: + curKeys = list(WireguardConfigurations.keys()) + for name in curKeys: + if name in WireguardConfigurations.keys() and WireguardConfigurations.get(name) is not None: + c = WireguardConfigurations.get(name) + if c.getStatus(): + c.getPeersTransfer() + c.getPeersLatestHandshake() + c.getPeersEndpoint() + c.getPeersList() + c.getRestrictedPeersList() + except Exception as e: + print(f"[WGDashboard] Background Thread #1 Error: {str(e)}", flush=True) time.sleep(10) def peerJobScheduleBackgroundThread():