-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Log error for plugins doing queries per-file during propfind #54153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
539302e to
68c9c6b
Compare
68c9c6b to
53486c0
Compare
come-nc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, be careful that the sabre server is built in several places, especially there is a ServerFactory, does the plugin need to be added there as well?
53486c0 to
ad9ff37
Compare
My IDE was configured to exclude the |
a86009a to
c62a214
Compare
apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php
Outdated
Show resolved
Hide resolved
1395d1c to
b936ef2
Compare
Signed-off-by: Salvatore Martire <[email protected]>
b936ef2 to
ec176a9
Compare
|
@salmart-dev I believe we have to revert this PR. It currently breaks creating invitations and possibly more things in the CalDAV backend (read: you can't invite anyone on master in Calendar events). My only idea would be to make an exemption for the ACL plugin so that it will never be wrapped. ProblemTL;DR: Inside Sabre, event listeners are sometimes removed. However, this won't work anymore as the actual event listener is wrapped inside an anonymous function/closure and the Sabre code checks for the identity of the listener ( In $aclPlugin = $this->server->getPlugin('acl');
// [...]
$this->server->removeListener('propFind', [$aclPlugin, 'propFind']);It disables the ACLs for a short period in order to access the invitee's properties to get their default schedule calendar URL. However, the line above won't work if the "real" listener is wrapped inside a closure. As a result, the listener is not removed anymore and the ACL checks still run and fail. |
|
In case excluding the plugin is acceptable: #54485 |
Summary
Plugins should avoid querying properties per-file and rather eager load them per directory to avoid doing too many round-trips to the database, which cost time.
To ease troubleshooting, this PR adds logging that triggers when loading properties runs queries for every node it scans.
Implementation
At the moment, loading properties from the DB happens when each node is serialized into XML to respond to the client, unless pre-loaded. For this reason, detection is implemented as a wrapper for the
on/oncemethods in our Server connector, for thepropFindevent. This event is triggered at least once for every node returned in the response.Note: due to the fact that
propFindis called at least once per node, the detection of how many nodes have caused a read from the DB is not the same to the unique number of nodes treated by the propfind. For example:CorePluginregisters threeonhandlers for thepropFindevent and, if they all read properties from the DB, will count each node three times.Checklist