|
...
|
...
|
@@ -29,6 +29,7 @@ use App\Models\WebSetting\WebSettingReceiving; |
|
|
|
use App\Services\CosService;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
|
|
|
...
|
...
|
@@ -67,9 +68,14 @@ class ProjectUpdate extends Command |
|
|
|
protected function start_update()
|
|
|
|
{
|
|
|
|
$task_id = $this->get_task();
|
|
|
|
if (!$task_id) {
|
|
|
|
if ($task_id === false) {
|
|
|
|
//所有任务执行完成
|
|
|
|
sleep(60);
|
|
|
|
return true;
|
|
|
|
} elseif ($task_id === 0) {
|
|
|
|
//队列任务已处理完,有进程正在查询数据库,等待5秒后执行
|
|
|
|
sleep(5);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$task = UpdateLog::where('id', $task_id)->where('status', UpdateLog::STATUS_UN)->first();
|
|
...
|
...
|
@@ -794,6 +800,11 @@ class ProjectUpdate extends Command |
|
|
|
return $task_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Cache::add('console_update_task_select_mysql', true, 5)) {
|
|
|
|
//如果存在数据锁,表示有其他进程已往下执行,当前进程直接返回
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$task_list = UpdateLog::where('status', UpdateLog::STATUS_UN)->orderBy('sort', 'asc')->orderBy('updated_at', 'asc')->limit(20)->get();
|
|
|
|
if ($task_list->count() == 0) {
|
|
|
|
return false;
|
...
|
...
|
|