Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Db/EventWrapperRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace OCA\Circles\Db;

use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OCA\Circles\Model\Federated\EventWrapper;
use OCP\DB\Exception;
use Psr\Log\LoggerInterface;

/**
Expand Down Expand Up @@ -42,7 +42,7 @@

try {
$qb->execute();
} catch (Exception $e) {
} catch (UniqueConstraintViolationException $e) {

Check failure on line 45 in lib/Db/EventWrapperRequest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedClass

lib/Db/EventWrapperRequest.php:45:12: UndefinedClass: Class, interface or enum named Doctrine\DBAL\Exception\UniqueConstraintViolationException does not exist (see https://psalm.dev/019)
$logger = \OCP\Server::get(LoggerInterface::class);
$logger->warning('issue while storing event', ['exception' => $e]);
}
Expand Down
8 changes: 8 additions & 0 deletions lib/Service/FederatedEventService.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,19 +395,27 @@
$wrapper->setCreation(time());
$wrapper->setSeverity($event->getSeverity());

$avoidDuplicate = [];
if ($event->isAsync()) {
$wrapper->setInstance($this->configService->getLoopbackInstance());
$this->eventWrapperRequest->save($wrapper);
$avoidDuplicate[] = $this->configService->getLoopbackInstance();
}

foreach ($instances as $instance) {
if ($event->getCircle()->isConfig(Circle::CFG_LOCAL)) {
break;
}

if (in_array($instance->getInstance(), $avoidDuplicate, true)) {
Server::get(\Psr\Log\LoggerInterface::class)->warning('duplicate instance, please verify the setup of Federated Teams', ['duplicate' => $avoidDuplicate, 'loopback' => $this->configService->getLoopbackInstance(), 'instance' => $instance->getInstance(), 'interface' => $instance->getInterface()]);

Check failure on line 411 in lib/Service/FederatedEventService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedClass

lib/Service/FederatedEventService.php:411:5: UndefinedClass: Class, interface or enum named OCA\Circles\Service\Server does not exist (see https://psalm.dev/019)
continue;
}

$wrapper->setInstance($instance->getInstance());
$wrapper->setInterface($instance->getInterface());
$this->eventWrapperRequest->save($wrapper);
$avoidDuplicate[] = $wrapper->getInstance();
}

$request = new NCRequest('', Request::TYPE_POST);
Expand Down
Loading