diff --git a/lib/Service/SessionService.php b/lib/Service/SessionService.php index 4bad14cc2..a7a0b46e7 100644 --- a/lib/Service/SessionService.php +++ b/lib/Service/SessionService.php @@ -87,7 +87,13 @@ public function storeSessionDataInDatabase(): void { $sessionData->setTokenId($this->tokenProvider->getToken($this->session->getId())->getId()); $sessionData->setData($sessionDataModel); - $this->sessionDataMapper->insert($sessionData); + try { + $this->sessionDataMapper->insert($sessionData); + } catch (Exception $exception) { + if ($exception->getReason() === Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) { + $this->sessionDataMapper->update($sessionData); + } + } } protected function storeSessionDataInSession(SessionData $sessionData): void {