Skip to content

Commit

Permalink
Fix update actor failing because of a serializer error (#1098)
Browse files Browse the repository at this point in the history
  • Loading branch information
BentiGorlich authored Sep 9, 2024
1 parent 2069352 commit 26bc1c8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Service/RemoteInstanceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,18 @@ public function updateInstance(Instance $instance, bool $force = false): bool

$nodeInfoRaw = $this->client->fetchInstanceNodeInfo($linkToUse->href, false);
$this->logger->debug('got raw nodeinfo for url {url}: {raw}', ['raw' => $nodeInfoRaw, 'url' => $linkToUse]);
/** @var NodeInfo $nodeInfo */
$nodeInfo = $serializer->deserialize($nodeInfoRaw, NodeInfo::class, 'json');

$instance->software = $nodeInfo?->software?->name;
$instance->version = $nodeInfo?->software?->version;
try {
/** @var NodeInfo $nodeInfo */
$nodeInfo = $serializer->deserialize($nodeInfoRaw, NodeInfo::class, 'json');
$instance->software = $nodeInfo?->software?->name;
$instance->version = $nodeInfo?->software?->version;
} catch (\Error|\Exception $e) {
$this->logger->warning('There as an exception decoding the nodeinfo from {url}: {e} - {m}', [
'url' => $instance->domain,
'e' => \get_class($e),
'm' => $e->getMessage(),
]);
}
$instance->setUpdatedAt();
$this->entityManager->persist($instance);

Expand Down

0 comments on commit 26bc1c8

Please sign in to comment.