protected function tryGetPidInfo($key, $pid, $self = null) { $attempts = 0; $maxAttempts = 3; do { try { $pidInfo = $this->commandsManager->getPidLoadInfo($pid); if ($self) { $this->pidsInfo[LmConstants::SELF_PID . "{$key}"] = $pidInfo; } else { $this->pidsInfo[] = $pidInfo; } $attempts = $maxAttempts; } catch (\Exception $e) { $attempts++; $this->logger->error("Attempts to check info for PID {$pid}: {$attempts}"); if ($attempts === $maxAttempts) { $this->logger->error(LoggingExceptions::getExceptionString($e)); $this->finishedPids[] = $pid; unset($this->pids[$key]); } } } while ($attempts < $maxAttempts); return null; }