Background thread terminated when iterating conf list and list changed
This commit is contained in:
Donald Zou 2025-05-31 22:52:12 +08:00 committed by GitHub
commit ab5abe9bcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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():