From 994589f9485285a47130f018f77ef374b769190c Mon Sep 17 00:00:00 2001 From: dartcafe Date: Mon, 25 Nov 2024 10:17:12 +0100 Subject: [PATCH 1/2] fix namespace Signed-off-by: dartcafe --- tests/Unit/Db/OptionMapperTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Unit/Db/OptionMapperTest.php b/tests/Unit/Db/OptionMapperTest.php index 0db2409ce..f5a9eaab7 100644 --- a/tests/Unit/Db/OptionMapperTest.php +++ b/tests/Unit/Db/OptionMapperTest.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Polls\Db; +namespace OCA\Polls\Tests\Unit\Db; use OCA\Polls\Tests\Unit\UnitTestCase; @@ -24,11 +24,11 @@ class OptionMapperTest extends UnitTestCase { private OptionMapper $optionMapper; private PollMapper $pollMapper; private VoteMapper $voteMapper; - /** @var Poll[] $polls */ + /** @var Poll[] $polls */ private array $polls = []; - /** @var Option[] $options */ + /** @var Option[] $options */ private array $options = []; - /** @var Vote[] $votes */ + /** @var Vote[] $votes */ private array $votes = []; /** @@ -52,13 +52,13 @@ protected function setUp(): void { for ($count = 0; $count < 2; $count++) { - /** @var Option $option */ + /** @var Option $option */ $option = $this->fm->instance('OCA\Polls\Db\Option'); $option->setPollId($poll->getId()); $option->syncOption(); array_push($this->options, $this->optionMapper->insert($option)); - /** @var Vote $vote */ + /** @var Vote $vote */ $vote = $this->fm->instance('OCA\Polls\Db\Vote'); $vote->setPollId($option->getPollId()); $vote->setUserId('TestUser'); From 9607faf17a568bdf0da31e8254027a623d8fb05b Mon Sep 17 00:00:00 2001 From: dartcafe Date: Mon, 25 Nov 2024 12:05:30 +0100 Subject: [PATCH 2/2] add search timer to debug log Signed-off-by: dartcafe --- lib/Service/SystemService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Service/SystemService.php b/lib/Service/SystemService.php index 8cb31e6e3..3c9aad5c6 100644 --- a/lib/Service/SystemService.php +++ b/lib/Service/SystemService.php @@ -80,6 +80,7 @@ public function getSiteUsersAndGroups(string $query = ''): array { * get a list of user objects from the backend matching the query string */ public function search(string $query = ''): array { + $startSearchTimer = microtime(true); $items = []; $types = [ IShare::TYPE_USER, @@ -91,8 +92,9 @@ public function search(string $query = ''): array { // Add circles to the search, if app is enabled $types[] = IShare::TYPE_CIRCLE; } - + $startCollaborationSearchTimer = microtime(true); [$result, $more] = $this->userSearch->search($query, $types, false, $maxResults, 0); + $this->logger->debug('Search took {time}s', ['time' => microtime(true) - $startCollaborationSearchTimer]); if ($more) { $this->logger->info('Only first {maxResults} matches will be returned.', ['maxResults' => $maxResults]); @@ -150,7 +152,7 @@ public function search(string $query = ''): array { $items[] = $this->userMapper->getUserObject(Circle::TYPE, $item['value']['shareWith'])->getRichUserArray(); } } - + $this->logger->debug('Search took {time}s overall', ['time' => microtime(true) - $startSearchTimer]); return $items; }