Browse Source

第一个线程加错误打印

zhangdongming 11 months ago
parent
commit
e4c86745f2
1 changed files with 18 additions and 14 deletions
  1. 18 14
      Controller/DetectControllerV2.py

+ 18 - 14
Controller/DetectControllerV2.py

@@ -174,17 +174,21 @@ class NotificationV2View(View):
 
 def push_and_save_data(**params):
     uid = params['uid']
-    TIME_LOGGER.info('{}开始异步存表和推送'.format(uid))
-
-    # 线程池推送消息
-    # thread_pool = GlobalThreadPool()
-    # thread_pool.submit(DevicePushService.push_msg, **params)
-
-    # 异步推送消息
-    push_thread = threading.Thread(
-        target=DevicePushService.push_msg,
-        kwargs=params)
-    push_thread.start()
-    # 保存推送数据
-    result = DevicePushService.save_msg_push(**params)
-    TIME_LOGGER.info('{}存表结果:{}'.format(uid, result))
+    try:
+        TIME_LOGGER.info('{}开始异步存表和推送'.format(uid))
+
+        # 线程池推送消息
+        # thread_pool = GlobalThreadPool()
+        # thread_pool.submit(DevicePushService.push_msg, **params)
+
+        # 异步推送消息
+        push_thread = threading.Thread(
+            target=DevicePushService.push_msg,
+            kwargs=params)
+        push_thread.start()
+        # 保存推送数据
+        result = DevicePushService.save_msg_push(**params)
+        TIME_LOGGER.info('{}存表结果:{}'.format(uid, result))
+    except Exception as e:
+        ERROR_INFO_LOGGER.info(
+            'V2推送第一个线程异常{},error_line:{},error_msg:{}'.format(uid, e.__traceback__.tb_lineno, repr(e)))