Skip to content

Conversation

@juliusknorr
Copy link
Member

As from nextcloud/activity#617, getCloudId can be expensive, especially on large instances since curently the contacts manager is called to search for the cloud id which may lead to slow queries as it searches the oc_card_properties table with a LIKE with wildcards on every file action:

SELECT DISTINCT `cp`.`cardid` FROM `oc_cards_properties` `cp` WHERE (`cp`.`addressbookid` = N) AND (`cp`.`name` = N) AND (`cp`.`value`  COLLATE utfNmbN_general_ci LIKE '%[email protected]%');

For local users this PR allows to omit the remote parameter when getting the cloud id for a local user. The display name will then be fetched from the user manager instead and the remote URL will be constructed as it was done before in the User class.

@nickvergessen
Copy link
Member

Should we do a generic short cut in the getCloudId() for the local server?

@juliusknorr
Copy link
Member Author

@nickvergessen I added a shortcut as the id is also just constructed like this in the CloudIdManager, but having the possibility to request a local cloud id still makes sense for the manager I'd say, so I kept that.

@juliusknorr juliusknorr requested a review from blizzz July 14, 2021 14:08
@blizzz blizzz merged commit 5a22b0a into master Jul 14, 2021
@blizzz blizzz deleted the enh/cloud-id-local branch July 14, 2021 21:18
@juliusknorr
Copy link
Member Author

/backport f43c2b4 to stable22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants