Browse Source

MOD:广告素材拉取,由线程外包线程变为,进程包线程

cxyu 3 years ago
parent
commit
97644883ba
1 changed files with 6 additions and 6 deletions
  1. 6 6
      app/crontab_task/ad_hourly.py

+ 6 - 6
app/crontab_task/ad_hourly.py

@@ -5,7 +5,7 @@ import time
 from model.DingTalkUtils import DingTalkUtils
 import logging
 from logging import handlers
-import threading
+import multiprocessing
 
 du = DateUtils()
 
@@ -31,15 +31,15 @@ if __name__ == '__main__':
     logging.info('广告素材任务,开始')
     st = time.time()
 
-    hourly_thread = threading.Thread(target=hourly_run)
-    hourly_thread.daemon = True
-    hourly_thread.start()
+    hourly_process = multiprocessing.Process(target=hourly_run)
+    hourly_process.daemon = True
+    hourly_process.start()
 
     while 1:
         if time.time() - st > 3000:
-            logging.info('线程运行超过50分钟,强制停止')
+            logging.info('程运行超过50分钟,强制停止')
             break
-        if not hourly_thread.is_alive():
+        if not hourly_process.is_alive():
             break
 
     if int(time.time() - st) > 1500: