refs #1555. Changes eventListener Mercure
testing/ogcore-api/pipeline/head This commit looks good
Details
testing/ogcore-api/pipeline/head This commit looks good
Details
parent
d881c763cf
commit
a00dc7a59f
|
@ -24,6 +24,19 @@ class ClientStatusNotifier
|
|||
}
|
||||
|
||||
public function postUpdate(Client $client, PostUpdateEventArgs $event): void
|
||||
{
|
||||
try {
|
||||
$this->notifyClientStatusChange($client);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Error al notificar el cambio de estado de un cliente: ', [
|
||||
'client' => $client->getUuid(),
|
||||
'status' => $client->getStatus(),
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function notifyClientStatusChange(Client $client): void
|
||||
{
|
||||
$update = new Update(
|
||||
'clients',
|
||||
|
|
|
@ -25,10 +25,24 @@ class TraceStatusProgressNotifier
|
|||
}
|
||||
|
||||
public function postUpdate(Trace $trace, PostUpdateEventArgs $event): void
|
||||
{
|
||||
try {
|
||||
$this->notifyTraceStatusProgressChange($trace);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Error al notificar el cambio de estado de una traza/log: ', [
|
||||
'client' => $trace->getUuid(),
|
||||
'status' => $trace->getStatus(),
|
||||
'progress' => $trace->getProgress(),
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function notifyTraceStatusProgressChange(Trace $trace): void
|
||||
{
|
||||
$update = new Update(
|
||||
'traces',
|
||||
json_encode(['@id' => '/traces/'.$trace->getUuid(), 'status' => $trace->getStatus(), 'progress' => $trace->getProgress() / 100])
|
||||
json_encode(['@id' => '/traces/' . $trace->getUuid(), 'status' => $trace->getStatus(), 'progress' => $trace->getProgress() / 100])
|
||||
);
|
||||
$this->hub->publish($update);
|
||||
|
||||
|
|
Loading…
Reference in New Issue