Prechádzať zdrojové kódy

1. 发布接口超时时间设置成 60s
2. 每个异步任务之间,等待 60s

罗俊辉 7 mesiacov pred
rodič
commit
f90a68ad6e

+ 4 - 0
applications/deal/checkVideoStatusBeforePublish.py

@@ -0,0 +1,4 @@
+"""
+@author: luojunhui
+@description:
+"""

+ 1 - 1
applications/functions/common.py

@@ -244,7 +244,7 @@ async def async_post(url, headers, payload):
     async with aiohttp.ClientSession() as session:
         for attempt in range(3):
             try:
-                async with session.post(url, headers=headers, data=payload, timeout=10) as response:
+                async with session.post(url, headers=headers, data=payload, timeout=60) as response:
                     return await response.json()
             except asyncio.TimeoutError:
                 if attempt < retries - 1:

+ 5 - 3
matchVideoFromHistoryArticleASC.py

@@ -2,6 +2,8 @@
 @author: luojunhui
 """
 import datetime
+import time
+
 import aiomysql
 import asyncio
 
@@ -74,11 +76,11 @@ async def main():
     await TMC.init_pool()
     PD = MatchTask3(TMC)
     await PD.deal()
+    now_str = datetime.datetime.now().__str__()
+    print("{}    请求执行完成, 等待1分钟".format(now_str))
+    await asyncio.sleep(1 * 60)
 
 
 if __name__ == '__main__':
     while True:
         asyncio.run(main())
-        now_str = datetime.datetime.now().__str__()
-        print("{}    请求执行完成, 等待3分钟".format(now_str))
-        asyncio.sleep(3 * 60)

+ 3 - 3
matchVideoFromHistoryArticleDESC.py

@@ -74,11 +74,11 @@ async def main():
     await TMC.init_pool()
     PD = MatchTask4(TMC)
     await PD.deal()
+    now_str = datetime.datetime.now().__str__()
+    print("{}    请求执行完成, 等待1分钟".format(now_str))
+    await asyncio.sleep(1 * 60)
 
 
 if __name__ == '__main__':
     while True:
         asyncio.run(main())
-        now_str = datetime.datetime.now().__str__()
-        print("{}    请求执行完成, 等待5s".format(now_str))
-        asyncio.sleep(5)