Skip to content

Commit

Permalink
Optimized InfluxDB query usage
Browse files Browse the repository at this point in the history
  • Loading branch information
MatinF committed Nov 27, 2020
1 parent e0b3213 commit 144fcd2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dashboard-writer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(self, influx_url, token, org_id, influx_bucket, debug=False, verbos
self.debug = debug
self.verbose = verbose
self.client = InfluxDBClient(url=self.influx_url, token=self.token, org=self.org_id, debug=False)
self.test = self.test_influx()
return

def __del__(self):
Expand All @@ -82,7 +83,7 @@ def get_start_times(self, devices, default_start, dynamic):
device_ids = [device.split("/")[1] for device in devices]
start_times = []

if self.test_influx() == 0:
if self.test == 0:
for device in device_ids:
start_times.append(default_start_dt)
else:
Expand All @@ -106,7 +107,7 @@ def write_influx(self, name, df):
"""
from influxdb_client import WriteOptions

if self.test_influx() == 0:
if self.test == 0:
return

_write_client = self.client.write_api(
Expand Down

0 comments on commit 144fcd2

Please sign in to comment.