Check that priorQuery exists before using it

This commit is contained in:
Matthew McTague 2023-03-31 13:08:47 +13:00
parent afc44fde8e
commit 80a442724d

View File

@ -331,7 +331,7 @@ def getCircuitLatencyStats(subscriberCircuits):
# If we can't identify RTT this time around, use most recently recorded RTT
# None by default, change if found in priorQuery
circuit['stats']['sinceLastQuery']['tcpLatency'] = None
if circuit['stats']['priorQuery'] != None:
if 'priorQuery' in circuit['stats'] and circuit['stats']['priorQuery'] != None:
if 'priorQuery' in circuit['stats']:
if 'tcpLatency' in circuit['stats']['priorQuery']:
circuit['stats']['sinceLastQuery']['tcpLatency'] = circuit['stats']['priorQuery']['tcpLatency']