Ver código fonte

2024-06-13
异步定时任务

罗俊辉 1 ano atrás
pai
commit
90f1856f21
1 arquivos alterados com 3 adições e 1 exclusões
  1. 3 1
      task.py

+ 3 - 1
task.py

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