refs #952. First revision status endpoint ogAgent
testing/ogcore-api/pipeline/head Something is wrong with the build of this commit Details

develop-jenkins
Manuel Aranda Rosales 2024-10-22 22:12:40 +02:00
parent 14ff759309
commit 756bea4844
1 changed files with 9 additions and 3 deletions

View File

@ -47,9 +47,15 @@ class StatusAction extends AbstractController
try {
$response = $this->httpClient->request('POST', 'https://'.$client->getIp().':8000/ogAdmClient/status');
$client->setStatus('active');
$this->entityManager->persist($client);
$this->entityManager->flush();
if ($response->getStatusCode() !== Response::HTTP_OK) {
$client->setStatus('off');
$this->entityManager->persist($client);
$this->entityManager->flush();
} else if ($response->getStatusCode() === Response::HTTP_OK) {
$client->setStatus('active');
$this->entityManager->persist($client);
$this->entityManager->flush();
}
} catch (TransportExceptionInterface $e) {