Browse Source

2024-06-13
异步定时任务

罗俊辉 1 year ago
parent
commit
90f1856f21
1 changed files with 3 additions and 1 deletions
  1. 3 1
      task.py

+ 3 - 1
task.py

@@ -2,6 +2,7 @@
 @author: luojunhui
 @author: luojunhui
 """
 """
 import time
 import time
+import datetime
 import asyncio
 import asyncio
 
 
 import aiomysql
 import aiomysql
@@ -79,5 +80,6 @@ async def main():
 if __name__ == '__main__':
 if __name__ == '__main__':
     while True:
     while True:
         asyncio.run(main())
         asyncio.run(main())
-        print("请求执行完成, 等待120s")
+        now_str = datetime.datetime.now().__str__()
+        print("{}    请求执行完成, 等待120s".format(now_str))
         time.sleep(120)
         time.sleep(120)