Skip to content
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

Use a Generator for users in searchInGroups, type it as iterable #38026

Closed
wants to merge 1 commit into from

Conversation

come-nc
Copy link
Contributor

@come-nc come-nc commented May 2, 2023

Summary

Since this is a new method in 27 it’s the occasion to make use of a generator instead of an array

Checklist

@come-nc come-nc added the 2. developing Work in progress label May 2, 2023
@come-nc come-nc added this to the Nextcloud 27 milestone May 2, 2023
@come-nc come-nc self-assigned this May 2, 2023
@skjnldsv skjnldsv mentioned this pull request May 3, 2023
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc come-nc force-pushed the enh/use-iterable-for-searchingroup branch from 6659f28 to 8a8355a Compare May 4, 2023 12:30
This was referenced May 9, 2023
@@ -380,11 +385,9 @@ public function searchInGroup(string $gid, string $search = '', int $limit = -1,
$users = [];
$userManager = \OCP\Server::get(IUserManager::class);
while ($row = $result->fetch()) {
$users[$row['uid']] = new LazyUser($row['uid'], $userManager, $row['displayname'] ?? null);
yield $row['uid'] => new LazyUser($row['uid'], $userManager, $row['displayname'] ?? null);
}
$result->closeCursor();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not get called if the Generator is not exhausted by the caller, so this approach may be problematic.
Anyone have a better idea on how to do that?

@come-nc
Copy link
Contributor Author

come-nc commented May 11, 2023

Abandoning this, not enough time to try it out and see if it helps, and find a way to fix the cursor close problem.

@come-nc come-nc closed this May 11, 2023
@skjnldsv skjnldsv deleted the enh/use-iterable-for-searchingroup branch March 14, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant