Skip to content

Commit 0899597

Browse files
nickvergessenbackportbot[bot]
authored andcommitted
perf(sharing): Reduce load from listener as mount provider is doing bits already
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 6d03277 commit 0899597

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

lib/Share/Listener.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,16 @@ protected function overwriteMountPoint(VerifyMountPointEvent $event): void {
6060
}
6161

6262
if ($event->getParent() === RoomShareProvider::TALK_FOLDER_PLACEHOLDER) {
63-
try {
64-
$userId = $view->getOwner('/');
65-
} catch (\Exception $e) {
66-
// If we fail to get the owner of the view from the cache,
67-
// e.g. because the user never logged in but a cron job runs
68-
// We fall back to calculating the owner from the root of the view:
69-
if (substr_count($view->getRoot(), '/') >= 2) {
70-
// /37c09aa0-1b92-4cf6-8c66-86d8cac8c1d0/files
71-
[, $userId, ] = explode('/', $view->getRoot(), 3);
72-
} else {
73-
// Something weird is going on, we can't fall back more
74-
// so for now we don't overwrite the share path ¯\_(ツ)_/¯
75-
return;
76-
}
63+
// If we fail to get the owner of the view from the cache,
64+
// e.g. because the user never logged in but a cron job runs
65+
// We fall back to calculating the owner from the root of the view:
66+
if (substr_count($view->getRoot(), '/') >= 2) {
67+
// /37c09aa0-1b92-4cf6-8c66-86d8cac8c1d0/files
68+
[, $userId, ] = explode('/', $view->getRoot(), 3);
69+
} else {
70+
// Something weird is going on, we can't fall back more
71+
// so for now we don't overwrite the share path ¯\_(ツ)_/¯
72+
return;
7773
}
7874

7975
$parent = $this->config->getAttachmentFolder($userId);

tests/psalm-baseline.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.13.1@1e3b7f0a8ab32b23197b91107adc0a7ed8a05b51">
2+
<files psalm-version="6.14.3@d0b040a91f280f071c1abcb1b77ce3822058725a">
33
<file src="lib/AppInfo/Application.php">
44
<UndefinedClass>
55
<code><![CDATA[BeforeTemplateRenderedEvent]]></code>
@@ -159,7 +159,6 @@
159159
<code><![CDATA[$event->getView()]]></code>
160160
<code><![CDATA[$view]]></code>
161161
<code><![CDATA[$view]]></code>
162-
<code><![CDATA[$view]]></code>
163162
<code><![CDATA[Filesystem]]></code>
164163
</UndefinedClass>
165164
</file>

0 commit comments

Comments
 (0)