Explorar o código

主线程等待子线程结束

peng hai 1 ano
pai
achega
ab7c5d29d4
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      Controller/Cron/CronTaskController.py

+ 2 - 0
Controller/Cron/CronTaskController.py

@@ -1584,6 +1584,7 @@ class CronComparedDataView(View):
             thread = threading.Thread(target=CronComparedDataView.thread_compared_wechat_order,
                                       args=(order_list,))
             thread.start()
+            thread.join()  # 主线程等待子线程结束
             return response.json(0)
         except Exception as e:
             LOGGER.info('CronComparedDataView.compared_wechat_order, errLine:{}, errMsg:{}'.format(
@@ -1643,6 +1644,7 @@ class CronComparedDataView(View):
             thread = threading.Thread(target=CronComparedDataView.thread_compared_alipay_order,
                                       args=(order_list,))
             thread.start()
+            thread.join()  # 主线程等待子线程结束
             return response.json(0)
         except Exception as e:
             LOGGER.info('CronComparedDataView.compared_alipay_order, errLine:{}, errMsg:{}'.format(