Browse Source

while增加退出条件,不然可能导致死循环定时任务压根就不执行

qiushiyong 11 months ago
parent
commit
c0fd23ef07
1 changed files with 5 additions and 1 deletions
  1. 5 1
      App/Crontab/ElasticSearchGoodsNewCrontab2.php

+ 5 - 1
App/Crontab/ElasticSearchGoodsNewCrontab2.php

@@ -38,11 +38,15 @@ class ElasticSearchGoodsNewCrontab2 implements JobInterface
         //定时任务的执行逻辑
 //        $welfare_api_set = Config::getInstance()->getConf('WELFARE_API');
         $welfare_api_set = [
-            'url' => 'https://open.api.superdesk.cn/api/base/dict_new/pushGoods',
+//            'url' => 'https://open.api.superdesk.cn/api/base/dict_new/pushGoods',
+            'url' => 'http://open.api.superdesk.cn/api/base/dict_new/pushGoods',
 //            'url' => '',
         ];
         $page = 1;
         while (true) {
+            if ($page > 20) {
+                break;
+            }
             $goods = $this->getUpdateGoods($page);
             if (!$goods) {
                 break;