Browse Source

newContentIdTask.py
add info: 每次任务获取任务数量详情

罗俊辉 6 months ago
parent
commit
bbc475f93f
1 changed files with 10 additions and 6 deletions
  1. 10 6
      newContentIdTask.py

+ 10 - 6
newContentIdTask.py

@@ -8,20 +8,24 @@ from applications.db import AsyncMySQLClient
 from tasks.newContentIdTask import NewContentIdTask
 
 
-async def main():
+async def main_job():
     """
     main job
     :return:
     """
-    async_mysql_pool = AsyncMySQLClient()
-    await async_mysql_pool.init_pool()
-    new_content_id_task = NewContentIdTask(async_mysql_pool)
-    await new_content_id_task.deal()
+    # async_mysql_pool = AsyncMySQLClient()
+    # await async_mysql_pool.init_pool()
+    # new_content_id_task = NewContentIdTask(async_mysql_pool)
+    # await new_content_id_task.deal()
+    async with AsyncMySQLClient() as async_mysql_pool:
+        await async_mysql_pool.init_pool()
+        new_content_id_task = NewContentIdTask(async_mysql_pool)
+        await new_content_id_task.deal()
 
 
 if __name__ == '__main__':
     while True:
-        asyncio.run(main())
+        asyncio.run(main_job())
         now_str = datetime.datetime.now().__str__()
         print("{}    请求执行完成, 等待60s".format(now_str))
         time.sleep(60)