提交 60728fcfdc4e5281e63ca47f404a3cb06c31135c

作者 qianyingz
1 个父辈 6f120876

加密和支持传入重定向地址

@@ -151,7 +151,7 @@ def create_schedule(): @@ -151,7 +151,7 @@ def create_schedule():
151 151
152 # 创建数据库 152 # 创建数据库
153 db.init_app(monitor) 153 db.init_app(monitor)
154 - db.create_all(app=monitor) 154 + # db.create_all(app=monitor)
155 155
156 # 跨域设置 156 # 跨域设置
157 CORS(monitor) 157 CORS(monitor)
@@ -61,13 +61,19 @@ def pull_metric(): @@ -61,13 +61,19 @@ def pull_metric():
61 # 获取数据并汇聚为1min的数据入库 61 # 获取数据并汇聚为1min的数据入库
62 # 结束 62 # 结束
63 except Exception as e: 63 except Exception as e:
  64 + sys_session.rollback()
64 StructurePrint().print(e.__str__()+":" + traceback.format_exc(), "error") 65 StructurePrint().print(e.__str__()+":" + traceback.format_exc(), "error")
65 finally: 66 finally:
66 - sys_session.rollback()  
67 if sys_session: 67 if sys_session:
68 - sys_session.close() 68 + try:
  69 + sys_session.close()
  70 + except Exception as e:
  71 + StructurePrint().print(e.__str__()+":" + traceback.format_exc(), "error")
69 if sys_ds: 72 if sys_ds:
70 - sys_ds.Destroy() 73 + try:
  74 + sys_ds.Destroy()
  75 + except Exception as e:
  76 + StructurePrint().print(e.__str__()+":" + traceback.format_exc(), "error")
71 77
72 78
73 def start_schedule(): 79 def start_schedule():
@@ -77,7 +83,8 @@ def start_schedule(): @@ -77,7 +83,8 @@ def start_schedule():
77 schedule.every(1).minutes.do(pull_metric) 83 schedule.every(1).minutes.do(pull_metric)
78 stop_run_continuously = run_continuously() 84 stop_run_continuously = run_continuously()
79 except Exception as e: 85 except Exception as e:
80 - StructurePrint().print(e.__str__()+":" + traceback.format_exc(), "error") 86 + StructurePrint().print("start_schedule:"+e.__str__() +
  87 + ":" + traceback.format_exc(), "error")
81 88
82 # Do some other things... 89 # Do some other things...
83 # # Stop the background thread 90 # # Stop the background thread
注册登录 后发表评论