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

Fix issue in is_val_equal_to_tenant leading to redundant DB calls #215

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GuySharir
Copy link

As described in this issue we want to avoid making extra queries when using related managers.

The proposed solution avoids making extra DB calls by comparing the tenant field of val against self.tenant_value instead of comparing val with the whole tenant object.

Notes

is_val_equal_to_tenant is a bit misleading/bad naming as this function actually checks for in-equality.

I think we should do one of the following-

  • Change the name to is_not_equal_to_tenant and keep the same implementation
  • Update the logic to check for equality, keep the current name and update the condition where this is used to be negated

I can update this PR if you prefer one of these options, I wanted to keep this PR on the issue point and avoid cosmetics so didn't add these changes in advance.

@GuySharir
Copy link
Author

@microsoft-github-policy-service agree company="Twingate"

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.

1 participant