作者 赵彬吉

update

... ... @@ -31,20 +31,22 @@ class SyncSubmitTask extends Command
while (true) {
$task_id = Redis::rpop('sync_submit_task');
if(!$task_id){
sleep(3);
continue;
}
$this->output('任务' . $task_id . '开始');
$time = microtime();
$task_info = SyncSubmitTaskModel::find($task_id);
if (empty($task_info) || $task_info->status !=3) {
$this->output('任务不存在或者已执行');
continue;
}
$time1 = $time2 = $time3 = microtime();
try {
$project = Project::getProjectByDomain($task_info['data']['domain'] ?? '');
$task_info->project_id = $project->id;
$time2 = microtime();
SyncSubmitTaskService::handler($task_info);
$time3 = microtime();
$task_info->status = 1;
$task_info->save();
... ... @@ -68,6 +70,10 @@ class SyncSubmitTask extends Command
$this->output('任务失败:' . $e->getMessage());
}
$time4 = microtime();
if($time4 - $time1 > 1000){
$this->output('任务用时:' . $time2 - $time1 . '|' . $time3 - $time2 . '|' . $time4 - $time3);
}
}
}
... ...
... ... @@ -44,7 +44,6 @@ class SyncSubmitTaskDistribution extends Command
}
}
}
sleep(3);
}
}
... ...