作者 赵彬吉

update

... ... @@ -33,20 +33,21 @@ class SyncSubmitTask extends Command
if(!$task_id){
continue;
}
$this->output('任务' . $task_id . '开始');
$time = microtime();
$time = time();
DB::enableQueryLog(); //启用查询日志
$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();
... ... @@ -70,9 +71,11 @@ class SyncSubmitTask extends Command
$this->output('任务失败:' . $e->getMessage());
}
$time4 = microtime();
if(($time4 - $time) > 1000){
$this->output('任务用时:' . $time2 - $time1 . '|' . $time3 - $time2 . '|' . $time4 - $time3);
if((time() - $time) > 1){
//数据库查询
$this->output('任务用时:' . json_encode(DB::getQueryLog()));
}
}
}
... ...