From 8b33dd7be6a53d6dfe4ec7742245a81fbaccc52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Chac=C3=B3n?= Date: Mon, 6 Feb 2023 18:45:08 -0700 Subject: [PATCH] Fix https://github.com/LibreQoE/LibreQoS/issues/254 --- old/v1.3/graphInfluxDB.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/old/v1.3/graphInfluxDB.py b/old/v1.3/graphInfluxDB.py index 449478bb..201770b1 100644 --- a/old/v1.3/graphInfluxDB.py +++ b/old/v1.3/graphInfluxDB.py @@ -533,10 +533,11 @@ def refreshLatencyGraphs(): for circuit in subscriberCircuits: if circuit['stats']['sinceLastQuery']['tcpLatency'] != None: listOfAllLatencies.append(circuit['stats']['sinceLastQuery']['tcpLatency']) - currentNetworkLatency = statistics.median(listOfAllLatencies) - p = Point('TCP Latency').tag("Type", "Network").field("TCP Latency", currentNetworkLatency).time(timestamp) - write_api.write(bucket=influxDBBucket, record=p) - queriesToSendCount += 1 + if len(listOfAllLatencies) > 0: + currentNetworkLatency = statistics.median(listOfAllLatencies) + p = Point('TCP Latency').tag("Type", "Network").field("TCP Latency", currentNetworkLatency).time(timestamp) + write_api.write(bucket=influxDBBucket, record=p) + queriesToSendCount += 1 print("Added " + str(queriesToSendCount) + " points to InfluxDB.")