Browse Source

主线程等待子线程结束

peng 1 năm trước cách đây
mục cha
commit
ab7c5d29d4
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  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(