mirror of
https://github.com/omg-xtao/ytdlbot.git
synced 2024-11-16 03:45:23 +00:00
fix influxdb data
This commit is contained in:
parent
6d4b568b19
commit
93eb4387cc
@ -201,7 +201,8 @@ class MySQL:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if MYSQL_HOST:
|
if MYSQL_HOST:
|
||||||
self.con = pymysql.connect(host=MYSQL_HOST, user=MYSQL_USER, passwd=MYSQL_PASS, db="ytdl", charset="utf8mb4")
|
self.con = pymysql.connect(host=MYSQL_HOST, user=MYSQL_USER, passwd=MYSQL_PASS, db="ytdl",
|
||||||
|
charset="utf8mb4")
|
||||||
else:
|
else:
|
||||||
self.con = MagicMock()
|
self.con = MagicMock()
|
||||||
|
|
||||||
@ -222,7 +223,7 @@ class MySQL:
|
|||||||
class InfluxDB:
|
class InfluxDB:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.client = InfluxDBClient(host=os.getenv("INFLUX_HOST", "192.168.7.233"), database="celery")
|
self.client = InfluxDBClient(host=os.getenv("INFLUX_HOST", "192.168.7.233"), database="celery")
|
||||||
self.data = self.get_worker_data()
|
self.data = None
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.client.close()
|
self.client.close()
|
||||||
@ -297,6 +298,7 @@ class InfluxDB:
|
|||||||
|
|
||||||
def collect_data(self):
|
def collect_data(self):
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
|
self.data = self.get_worker_data()
|
||||||
self.__fill_worker_data()
|
self.__fill_worker_data()
|
||||||
self.__fill_overall_data()
|
self.__fill_overall_data()
|
||||||
self.__fill_redis_metrics()
|
self.__fill_redis_metrics()
|
||||||
|
Loading…
Reference in New Issue
Block a user