perf: Don't call twice the same query

Find entities will execute the query already, there is no need to do it
twice.

Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
This commit is contained in:
Carl Schwan
2025-08-13 13:31:11 +02:00
parent 0ed8b21b3c
commit 1e59511d8d

View File

@@ -45,8 +45,7 @@ class SessionMapper extends QBMapper {
$qb->select('id', 'board_id', 'last_contact', 'user_id', 'token') $qb->select('id', 'board_id', 'last_contact', 'user_id', 'token')
->from($this->getTableName()) ->from($this->getTableName())
->where($qb->expr()->eq('board_id', $qb->createNamedParameter($boardId))) ->where($qb->expr()->eq('board_id', $qb->createNamedParameter($boardId)))
->andWhere($qb->expr()->gt('last_contact', $qb->createNamedParameter(time() - SessionService::SESSION_VALID_TIME))) ->andWhere($qb->expr()->gt('last_contact', $qb->createNamedParameter(time() - SessionService::SESSION_VALID_TIME)));
->executeQuery();
return $this->findEntities($qb); return $this->findEntities($qb);
} }