This commit is contained in:
Jalin
2019-01-18 10:33:03 +08:00

View File

@@ -1,3 +1,4 @@
# -*- coding:utf-8 -*-
import datetime
import json
import sys
@@ -57,8 +58,12 @@ class QueryLog(BaseLog):
if not Config.is_cluster_enabled() and path.exists(self.data_path):
with open(self.data_path, encoding='utf-8') as f:
result = f.read()
if result:
try:
result = json.loads(result)
except json.JSONDecodeError as e:
self.add_quick_log('加载status.json失败, 文件内容为: {}.'.format(repr(result)))
self.flush()
result = {}
if Config.is_cluster_enabled():
result = self.get_data_from_cluster()