Browse Source

history 增加bot && history

luojunhui 5 months ago
parent
commit
a1292fa00c
1 changed files with 15 additions and 2 deletions
  1. 15 2
      historyTask.py

+ 15 - 2
historyTask.py

@@ -44,7 +44,20 @@ async def main():
                 "traceback": traceback.format_exc()
             }
         )
-        history_content_id_task = historyContentIdTask(async_mysql_pool)
+        try:
+            history_content_id_task = historyContentIdTask(async_mysql_pool)
+        except Exception as e:
+            logging(
+                code="history0003",
+                info="Init historyContentIdTask failed",
+                alg="historyContentIdTask",
+                function="main",
+                data={
+                    "error": str(e),
+                    "traceback": traceback.format_exc()
+                }
+            )
+            return
         await history_content_id_task.deal()
 
 
@@ -54,7 +67,7 @@ if __name__ == '__main__':
         now_str = datetime.datetime.now().__str__()
         print("{}    请求执行完成, 等待60s".format(now_str))
         logging(
-            code="history0003",
+            code="history0004",
             info="History task finished"
         )
         time.sleep(60)