Skip to content

Remove collectRoles that is not being assigned #2850

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

Closed
wants to merge 1 commit into from

Conversation

pkuiper
Copy link

@pkuiper pkuiper commented May 23, 2025

syncRoles does not need to call collectRoles.

The call is not being assigned to any variable, same as pull request #2840 does but for roles.

It does not seem to affect any tests

@erikn69
Copy link
Contributor

erikn69 commented May 27, 2025

@drbyte hi, I think #2840 should be reverted, and look for another type of optimization
if I remember correctly, this line was there to avoid detaching in an error state.

I explain the problem better
If you do syncPermissions('permission doesnt exist'), it will do a detach, then a collectPermissions('permission doesnt exist'), this step will generate PermissionDoesNotExist exception, so the detach is already permanent, the old permissions were lost, and the new ones were not added.

It was a quick solution that didn't add more queries to the process. Tests should have been added to prevent this problem from happening again. I'll add the tests.

@drbyte
Copy link
Collaborator

drbyte commented May 28, 2025

Agreed.

@drbyte drbyte closed this May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants