From 72ec40f1e60833b4859217f5b6006f5933df226e Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 11 Jun 2021 17:51:27 +0200 Subject: [PATCH] Ignore current participant if removed concurrently When retrieving the conversation list for a user, there is a time window between retrieving the list and the participant information. If in that time window, a concurrent request removes the user from the room, or even the room got deleted, this could cause a ParticipantNotFoundException. This fix prevents the latter exception to make the whole call return a 404. Instead, it skips the obsoleted entry and carries on with the list. Signed-off-by: Vincent Petry --- lib/Controller/RoomController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 3e4b7c317a4..74fa81a74af 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -212,6 +212,9 @@ public function getRooms(int $noStatusUpdate = 0): DataResponse { try { $return[] = $this->formatRoom($room, $room->getParticipant($this->userId)); } catch (RoomNotFoundException $e) { + } catch (ParticipantNotFoundException $e) { + // for example in case the room was deleted concurrently, + // the user is not a participant any more } catch (\RuntimeException $e) { } }