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 @@ public function save(EventWrapper $wrapper): void {

try {
$qb->execute();
} catch (Exception $e) {
} catch (UniqueConstraintViolationException $e) {
$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 @@ public function initBroadcast(FederatedEvent $event): bool {
$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()]);
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