修复worker等待状态bug

This commit is contained in:
JaguarJack
2020-07-09 08:37:03 +08:00
parent ea32a4cd33
commit 104ad3f744
3 changed files with 8 additions and 5 deletions

View File

@@ -35,9 +35,11 @@ trait Store
*/
public function storeStatus(array $status)
{
if (file_exists($this->getProcessStatusPath())) {
$workersStatus = $this->getProcessesStatus();
$workersStatus = $this->getProcessesStatus();
if (empty($workersStatus)) {
$this->writeStatusToFile([$status]);
} else {
// ['PID',, 'START_AT', 'STATUS', 'DEAL_TASKS', 'ERRORS', 'running_time', 'memory'];
$pids = array_column($workersStatus, 'pid');
@@ -52,8 +54,6 @@ trait Store
}
}
$this->writeStatusToFile($workersStatus);
} else {
file_put_contents($this->getProcessStatusPath(), \json_encode([$status]));
}
}