diff --git a/lib/Service/SessionService.php b/lib/Service/SessionService.php index b73a1fc0a..c4e59b911 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 {