合并分支 'akun' 到 'master'
Akun 查看合并请求 !527
正在显示
1 个修改的文件
包含
11 行增加
和
1 行删除
| @@ -16,6 +16,7 @@ use App\Models\Template\BCustomTemplate; | @@ -16,6 +16,7 @@ use App\Models\Template\BCustomTemplate; | ||
| 16 | use App\Services\CosService; | 16 | use App\Services\CosService; |
| 17 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| 18 | use Illuminate\Console\Command; | 18 | use Illuminate\Console\Command; |
| 19 | +use Illuminate\Support\Facades\Cache; | ||
| 19 | use Illuminate\Support\Facades\DB; | 20 | use Illuminate\Support\Facades\DB; |
| 20 | use Illuminate\Support\Facades\Redis; | 21 | use Illuminate\Support\Facades\Redis; |
| 21 | 22 | ||
| @@ -54,10 +55,14 @@ class HtmlCollect extends Command | @@ -54,10 +55,14 @@ class HtmlCollect extends Command | ||
| 54 | protected function start_collect() | 55 | protected function start_collect() |
| 55 | { | 56 | { |
| 56 | $task_id = $this->get_task(); | 57 | $task_id = $this->get_task(); |
| 57 | - if (!$task_id) { | 58 | + if ($task_id === false) { |
| 58 | //所有项目采集完成 | 59 | //所有项目采集完成 |
| 59 | sleep(60); | 60 | sleep(60); |
| 60 | return true; | 61 | return true; |
| 62 | + } elseif ($task_id === 0) { | ||
| 63 | + //队列任务已处理完,有进程正在查询数据库,等待2秒后执行 | ||
| 64 | + sleep(2); | ||
| 65 | + return true; | ||
| 61 | } | 66 | } |
| 62 | 67 | ||
| 63 | $task_arr = explode('_', $task_id); | 68 | $task_arr = explode('_', $task_id); |
| @@ -147,6 +152,11 @@ class HtmlCollect extends Command | @@ -147,6 +152,11 @@ class HtmlCollect extends Command | ||
| 147 | return false; | 152 | return false; |
| 148 | } | 153 | } |
| 149 | 154 | ||
| 155 | + if (!Cache::add('html_collect_select_mysql', true, 10)) { | ||
| 156 | + //如果存在数据锁,表示有其他进程已往下执行,当前进程直接返回 | ||
| 157 | + return 0; | ||
| 158 | + } | ||
| 159 | + | ||
| 150 | foreach ($update_log_list as $update_log) { | 160 | foreach ($update_log_list as $update_log) { |
| 151 | switch ($update_log->api_type) { | 161 | switch ($update_log->api_type) { |
| 152 | case 'page': | 162 | case 'page': |
-
请 注册 或 登录 后发表评论