Check that priorQuery exists before using it

This commit is contained in:
Matthew McTague 2023-03-31 13:08:47 +13:00 committed by Herbert Wolverson
parent 5d36828b35
commit 691a1d9e6d

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']